Skip to content

Commit

Permalink
restore MAX_PARTITIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Oct 29, 2024
1 parent d770df3 commit 10119d1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/drive.c
Original file line number Diff line number Diff line change
Expand Up @@ -2547,9 +2547,8 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m
// "The goggles, they do nothing!"
RefreshDriveLayout(hDrive);

const int max_parts = 4;
size = sizeof(DriveLayoutEx) - ((partition_style == PARTITION_STYLE_GPT) ?
((max_parts - pi) * sizeof(PARTITION_INFORMATION_EX)) : 0);
((MAX_PARTITIONS - pi) * sizeof(PARTITION_INFORMATION_EX)) : 0);
// The DRIVE_LAYOUT_INFORMATION_EX used by Microsoft, with its 1-sized array, is designed to overrun...
// coverity[overrun-buffer-arg]
if (!DeviceIoControl(hDrive, IOCTL_DISK_SET_DRIVE_LAYOUT_EX, (BYTE*)&DriveLayoutEx, size, NULL, 0, &size, NULL)) {
Expand Down

0 comments on commit 10119d1

Please sign in to comment.