mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] fix CodeQL warnings
This commit is contained in:
		
							parent
							
								
									d18260bec3
								
							
						
					
					
						commit
						3177e70e25
					
				
					 12 changed files with 27 additions and 27 deletions
				
			
		|  | @ -4,7 +4,7 @@ | ||||||
|  * Copyright 1992-1994 Remy Card <card@masi.ibp.fr> |  * Copyright 1992-1994 Remy Card <card@masi.ibp.fr> | ||||||
|  * Copyright 1995-1999 Theodore Ts'o |  * Copyright 1995-1999 Theodore Ts'o | ||||||
|  * Copyright 1999 David Beattie |  * Copyright 1999 David Beattie | ||||||
|  * Copyright 2011-2019 Pete Batard <pete@akeo.ie> |  * Copyright 2011-2023 Pete Batard <pete@akeo.ie> | ||||||
|  * |  * | ||||||
|  * This file is based on the minix file system programs fsck and mkfs |  * This file is based on the minix file system programs fsck and mkfs | ||||||
|  * written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi> |  * written and copyrighted by Linus Torvalds <Linus.Torvalds@cs.helsinki.fi> | ||||||
|  | @ -377,7 +377,7 @@ static int64_t do_read (HANDLE hDrive, unsigned char * buffer, uint64_t tryout, | ||||||
| 	if (got < 0) | 	if (got < 0) | ||||||
| 		got = 0; | 		got = 0; | ||||||
| 	if (got & 511) | 	if (got & 511) | ||||||
| 		uprintf("%sWeird value (%ld) in do_read\n", bb_prefix, got); | 		uprintf("%sWeird value (%lld) in do_read\n", bb_prefix, got); | ||||||
| 	got /= block_size; | 	got /= block_size; | ||||||
| 	return got; | 	return got; | ||||||
| } | } | ||||||
|  | @ -399,7 +399,7 @@ static int64_t do_write(HANDLE hDrive, unsigned char * buffer, uint64_t tryout, | ||||||
| 	if (got < 0) | 	if (got < 0) | ||||||
| 		got = 0; | 		got = 0; | ||||||
| 	if (got & 511) | 	if (got & 511) | ||||||
| 		uprintf("%sWeird value (%ld) in do_write\n", bb_prefix, got); | 		uprintf("%sWeird value (%lld) in do_write\n", bb_prefix, got); | ||||||
| 	got /= block_size; | 	got /= block_size; | ||||||
| 	return got; | 	return got; | ||||||
| } | } | ||||||
|  | @ -447,7 +447,7 @@ static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size | ||||||
| 		if (detect_fakes && (pat_idx == 0)) { | 		if (detect_fakes && (pat_idx == 0)) { | ||||||
| 			srand((unsigned int)GetTickCount64()); | 			srand((unsigned int)GetTickCount64()); | ||||||
| 			id_offset = rand() * (block_size - sizeof(blk64_t)) / RAND_MAX; | 			id_offset = rand() * (block_size - sizeof(blk64_t)) / RAND_MAX; | ||||||
| 			uprintf("%sUsing offset %d for fake device check\n", bb_prefix, id_offset); | 			uprintf("%sUsing offset %zu for fake device check\n", bb_prefix, id_offset); | ||||||
| 		} | 		} | ||||||
| 		// coverity[dont_call]
 | 		// coverity[dont_call]
 | ||||||
| 		pattern_fill(buffer, pattern[pattern_type][pat_idx], blocks_at_once * block_size); | 		pattern_fill(buffer, pattern[pattern_type][pat_idx], blocks_at_once * block_size); | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
|  * Rufus: The Reliable USB Formatting Utility |  * Rufus: The Reliable USB Formatting Utility | ||||||
|  * DOS boot file extraction, from the FAT12 floppy image in diskcopy.dll |  * DOS boot file extraction, from the FAT12 floppy image in diskcopy.dll | ||||||
|  * (MS WinME DOS) or from the embedded FreeDOS resource files |  * (MS WinME DOS) or from the embedded FreeDOS resource files | ||||||
|  * Copyright © 2011-2021 Pete Batard <pete@akeo.ie> |  * Copyright © 2011-2023 Pete Batard <pete@akeo.ie> | ||||||
|  * |  * | ||||||
|  * This program is free software: you can redistribute it and/or modify |  * This program is free software: you can redistribute it and/or modify | ||||||
|  * it under the terms of the GNU General Public License as published by |  * it under the terms of the GNU General Public License as published by | ||||||
|  | @ -235,7 +235,7 @@ static BOOL ExtractFAT(int entry, const char* path) | ||||||
| 	filestart = (dir_entry->FirstCluster + FAT12_CLUSTER_OFFSET)*FAT12_CLUSTER_SIZE; | 	filestart = (dir_entry->FirstCluster + FAT12_CLUSTER_OFFSET)*FAT12_CLUSTER_SIZE; | ||||||
| 	filesize = dir_entry->FileSize; | 	filesize = dir_entry->FileSize; | ||||||
| 	if ((filestart + filesize) > DiskImageSize) { | 	if ((filestart + filesize) > DiskImageSize) { | ||||||
| 		uprintf("FAT File %s would be out of bounds: %X, %X", filename, filestart, filesize); | 		uprintf("FAT File %s would be out of bounds: %zX, %zX", filename, filestart, filesize); | ||||||
| 		uprintf("%X, %X", dir_entry->FirstCluster, dir_entry->FileSize); | 		uprintf("%X, %X", dir_entry->FirstCluster, dir_entry->FileSize); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
|  | @ -278,7 +278,7 @@ static BOOL ExtractFAT(int entry, const char* path) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	safe_closehandle(hFile); | 	safe_closehandle(hFile); | ||||||
| 	uprintf("Successfully wrote '%s' (%d bytes)", filename, filesize); | 	uprintf("Successfully wrote '%s' (%zu bytes)", filename, filesize); | ||||||
| 
 | 
 | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1129,7 +1129,7 @@ static BOOL _GetDriveLettersAndType(DWORD DriveIndex, char* drive_letters, UINT* | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	if (size > sizeof(drives)) { | 	if (size > sizeof(drives)) { | ||||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives)); | 		uprintf("GetLogicalDriveStrings: Buffer too small (required %lu vs. %zu)", size, sizeof(drives)); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1266,7 +1266,7 @@ char GetUnusedDriveLetter(void) | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 	if (size > sizeof(drives)) { | 	if (size > sizeof(drives)) { | ||||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives)); | 		uprintf("GetLogicalDriveStrings: Buffer too small (required %lu vs. %zu)", size, sizeof(drives)); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1295,7 +1295,7 @@ BOOL IsDriveLetterInUse(const char drive_letter) | ||||||
| 		return TRUE; | 		return TRUE; | ||||||
| 	} | 	} | ||||||
| 	if (size > sizeof(drives)) { | 	if (size > sizeof(drives)) { | ||||||
| 		uprintf("GetLogicalDriveStrings: Buffer too small (required %d vs. %d)", size, sizeof(drives)); | 		uprintf("GetLogicalDriveStrings: Buffer too small (required %lu vs. %zu)", size, sizeof(drives)); | ||||||
| 		return TRUE; | 		return TRUE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -736,7 +736,7 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi | ||||||
| 	if (num_sectors_to_clear < 4) | 	if (num_sectors_to_clear < 4) | ||||||
| 		num_sectors_to_clear = (DWORD)((add1MB ? 2048 : 0) + MAX_SECTORS_TO_CLEAR); | 		num_sectors_to_clear = (DWORD)((add1MB ? 2048 : 0) + MAX_SECTORS_TO_CLEAR); | ||||||
| 
 | 
 | ||||||
| 	uprintf("Erasing %d sectors", num_sectors_to_clear); | 	uprintf("Erasing %llu sectors", num_sectors_to_clear); | ||||||
| 	pZeroBuf = calloc(SectorSize, (size_t)num_sectors_to_clear); | 	pZeroBuf = calloc(SectorSize, (size_t)num_sectors_to_clear); | ||||||
| 	if (pZeroBuf == NULL) { | 	if (pZeroBuf == NULL) { | ||||||
| 		FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_NOT_ENOUGH_MEMORY; | 		FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_NOT_ENOUGH_MEMORY; | ||||||
|  |  | ||||||
|  | @ -394,17 +394,17 @@ BOOL FormatLargeFAT32(DWORD DriveIndex, uint64_t PartitionOffset, DWORD ClusterS | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Now we're committed - print some info first
 | 	// Now we're committed - print some info first
 | ||||||
| 	uprintf("Size : %s %u sectors", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE, FALSE), TotalSectors); | 	uprintf("Size : %s %lu sectors", SizeToHumanReadable(piDrive.PartitionLength.QuadPart, TRUE, FALSE), TotalSectors); | ||||||
| 	uprintf("Cluster size %d bytes, %d bytes per sector", SectorsPerCluster * BytesPerSect, BytesPerSect); | 	uprintf("Cluster size %lu bytes, %lu bytes per sector", SectorsPerCluster * BytesPerSect, BytesPerSect); | ||||||
| 	uprintf("Volume ID is %x:%x", VolumeId >> 16, VolumeId & 0xffff); | 	uprintf("Volume ID is %x:%x", VolumeId >> 16, VolumeId & 0xffff); | ||||||
| 	uprintf("%d Reserved sectors, %d sectors per FAT, %d FATs", ReservedSectCount, FatSize, NumFATs); | 	uprintf("%lu Reserved sectors, %lu sectors per FAT, %lu FATs", ReservedSectCount, FatSize, NumFATs); | ||||||
| 	uprintf("%d Total clusters", ClusterCount); | 	uprintf("%llu Total clusters", ClusterCount); | ||||||
| 
 | 
 | ||||||
| 	// Fix up the FSInfo sector
 | 	// Fix up the FSInfo sector
 | ||||||
| 	pFAT32FsInfo->dFree_Count = (UserAreaSize / SectorsPerCluster) - 1; | 	pFAT32FsInfo->dFree_Count = (UserAreaSize / SectorsPerCluster) - 1; | ||||||
| 	pFAT32FsInfo->dNxt_Free = 3; // clusters 0-1 reserved, we used cluster 2 for the root dir
 | 	pFAT32FsInfo->dNxt_Free = 3; // clusters 0-1 reserved, we used cluster 2 for the root dir
 | ||||||
| 
 | 
 | ||||||
| 	uprintf("%d Free clusters", pFAT32FsInfo->dFree_Count); | 	uprintf("%lu Free clusters", pFAT32FsInfo->dFree_Count); | ||||||
| 	// Work out the Cluster count
 | 	// Work out the Cluster count
 | ||||||
| 
 | 
 | ||||||
| 	// First zero out ReservedSect + FatSize * NumFats + SectorsPerCluster
 | 	// First zero out ReservedSect + FatSize * NumFats + SectorsPerCluster
 | ||||||
|  |  | ||||||
|  | @ -1465,7 +1465,7 @@ int iso9660_readfat(intptr_t pp, void *buf, size_t secsize, libfat_sector_t sec) | ||||||
| 	iso9660_readfat_private* p_private = (iso9660_readfat_private*)pp; | 	iso9660_readfat_private* p_private = (iso9660_readfat_private*)pp; | ||||||
| 
 | 
 | ||||||
| 	if (sizeof(p_private->buf) % secsize != 0) { | 	if (sizeof(p_private->buf) % secsize != 0) { | ||||||
| 		uprintf("iso9660_readfat: Sector size %d is not a divisor of %d", secsize, sizeof(p_private->buf)); | 		uprintf("iso9660_readfat: Sector size %zu is not a divisor of %zu", secsize, sizeof(p_private->buf)); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -994,7 +994,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param) | ||||||
| 		PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, | 		PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, | ||||||
| 		dwPipeSize, dwPipeSize, 0, NULL); | 		dwPipeSize, dwPipeSize, 0, NULL); | ||||||
| 	if (hPipe == INVALID_HANDLE_VALUE) { | 	if (hPipe == INVALID_HANDLE_VALUE) { | ||||||
| 		uprintf("Could not create pipe '%s': %s", pipe, WindowsErrorString); | 		uprintf("Could not create pipe '%s': %s", pipe, WindowsErrorString()); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1341,7 +1341,7 @@ static BOOL get_data_from_asn1_internal(const uint8_t* buf, size_t buf_len, cons | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			if (len > buf_len - pos) { | 			if (len > buf_len - pos) { | ||||||
| 				uprintf("get_data_from_asn1: Overflow error (computed length %d is larger than remaining data)", len); | 				uprintf("get_data_from_asn1: Overflow error (computed length %zu is larger than remaining data)", len); | ||||||
| 				return FALSE; | 				return FALSE; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -728,7 +728,7 @@ BOOL SearchProcessAlt(char* HandleName) | ||||||
| 		bFound = TRUE; | 		bFound = TRUE; | ||||||
| 		uprintf("WARNING: The following process(es) or service(s) are accessing %s:", HandleName); | 		uprintf("WARNING: The following process(es) or service(s) are accessing %s:", HandleName); | ||||||
| 		for (i = 0; i < info->NumberOfProcessIdsInList; i++) { | 		for (i = 0; i < info->NumberOfProcessIdsInList; i++) { | ||||||
| 			uprintf("o Process with PID %ld", info->ProcessIdList[i]); | 			uprintf("o Process with PID %llu", (uint64_t)info->ProcessIdList[i]); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 232, 326 | IDD_DIALOG DIALOGEX 12, 12, 232, 326 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_ACCEPTFILES | EXSTYLE WS_EX_ACCEPTFILES | ||||||
| CAPTION "Rufus 4.0.2028" | CAPTION "Rufus 4.0.2029" | ||||||
| FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | FONT 9, "Segoe UI Symbol", 400, 0, 0x0 | ||||||
| BEGIN | BEGIN | ||||||
|     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP |     LTEXT           "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP | ||||||
|  | @ -392,8 +392,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 4,0,2028,0 |  FILEVERSION 4,0,2029,0 | ||||||
|  PRODUCTVERSION 4,0,2028,0 |  PRODUCTVERSION 4,0,2029,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -411,13 +411,13 @@ BEGIN | ||||||
|             VALUE "Comments", "https://rufus.ie" |             VALUE "Comments", "https://rufus.ie" | ||||||
|             VALUE "CompanyName", "Akeo Consulting" |             VALUE "CompanyName", "Akeo Consulting" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "4.0.2028" |             VALUE "FileVersion", "4.0.2029" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" |             VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" | ||||||
|             VALUE "OriginalFilename", "rufus-4.0.exe" |             VALUE "OriginalFilename", "rufus-4.0.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "4.0.2028" |             VALUE "ProductVersion", "4.0.2029" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ int libfat_readfile(intptr_t pp, void *buf, size_t secsize, libfat_sector_t sect | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (bytes_read != secsize) { | 	if (bytes_read != secsize) { | ||||||
| 		uprintf("Sector %llu: Read %d bytes instead of %d requested", sector, bytes_read, secsize); | 		uprintf("Sector %llu: Read %lu bytes instead of %zu requested", sector, bytes_read, secsize); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -368,7 +368,7 @@ DWORD WINAPI WimProgressCallback(DWORD dwMsgId, WPARAM wParam, LPARAM lParam, PV | ||||||
| 	case WIM_MSG_ERROR: | 	case WIM_MSG_ERROR: | ||||||
| 		if (level == NULL) level = "error"; | 		if (level == NULL) level = "error"; | ||||||
| 		SetLastError((DWORD)lParam); | 		SetLastError((DWORD)lParam); | ||||||
| 		uprintf("WIM processing %s: %S [err = %d]\n", level, (PWSTR)wParam, WindowsErrorString()); | 		uprintf("WIM processing %s: %S [%s]\n", level, (PWSTR)wParam, WindowsErrorString()); | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue