mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] fix Coverity and CodeQL warnings
* Also make sure to build Release for static analysis.
This commit is contained in:
		
							parent
							
								
									a787fb34b3
								
							
						
					
					
						commit
						366ce99712
					
				
					 12 changed files with 26 additions and 16 deletions
				
			
		
							
								
								
									
										2
									
								
								.github/workflows/codeql.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/codeql.yml
									
										
									
									
										vendored
									
									
								
							|  | @ -28,7 +28,7 @@ on: | ||||||
| 
 | 
 | ||||||
| env: | env: | ||||||
|   SOLUTION_FILE_PATH: ./rufus.sln |   SOLUTION_FILE_PATH: ./rufus.sln | ||||||
|   BUILD_CONFIGURATION: Debug |   BUILD_CONFIGURATION: Release | ||||||
|   TARGET_PLATFORM: x64 |   TARGET_PLATFORM: x64 | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								.github/workflows/coverity.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/coverity.yml
									
										
									
									
										vendored
									
									
								
							|  | @ -16,7 +16,7 @@ on: | ||||||
| env: | env: | ||||||
|   SOLUTION_FILE_PATH: ./rufus.sln |   SOLUTION_FILE_PATH: ./rufus.sln | ||||||
|   EMAIL: pete@akeo.ie |   EMAIL: pete@akeo.ie | ||||||
|   BUILD_CONFIGURATION: Debug |   BUILD_CONFIGURATION: Release | ||||||
|   TARGET_PLATFORM: x64 |   TARGET_PLATFORM: x64 | ||||||
|   COVERITY_PROJECT_NAME: pbatard%2Frufus |   COVERITY_PROJECT_NAME: pbatard%2Frufus | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
|   <Identity |   <Identity | ||||||
|     Name="19453.net.Rufus" |     Name="19453.net.Rufus" | ||||||
|     Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" |     Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740" | ||||||
|     Version="3.16.1817.0" /> |     Version="3.16.1818.0" /> | ||||||
| 
 | 
 | ||||||
|   <Properties> |   <Properties> | ||||||
|     <DisplayName>Rufus</DisplayName> |     <DisplayName>Rufus</DisplayName> | ||||||
|  |  | ||||||
|  | @ -1351,7 +1351,7 @@ int TestChecksum(void) | ||||||
| 	int i, j, errors = 0; | 	int i, j, errors = 0; | ||||||
| 	uint8_t sum[MAX_HASHSIZE], *sum_expected; | 	uint8_t sum[MAX_HASHSIZE], *sum_expected; | ||||||
| 	size_t full_msg_len = strlen(test_msg); | 	size_t full_msg_len = strlen(test_msg); | ||||||
| 	char* msg = malloc(full_msg_len); | 	char* msg = malloc(full_msg_len + 1); | ||||||
| 	if (msg == NULL) | 	if (msg == NULL) | ||||||
| 		return -1; | 		return -1; | ||||||
| 
 | 
 | ||||||
|  | @ -1364,7 +1364,7 @@ int TestChecksum(void) | ||||||
| 		copy_msg_len[2] = blocksize[j] - (blocksize[j] >> 3); | 		copy_msg_len[2] = blocksize[j] - (blocksize[j] >> 3); | ||||||
| 		copy_msg_len[3] = full_msg_len; | 		copy_msg_len[3] = full_msg_len; | ||||||
| 		for (i = 0; i < 4; i++) { | 		for (i = 0; i < 4; i++) { | ||||||
| 			memset(msg, 0, full_msg_len); | 			memset(msg, 0, full_msg_len + 1); | ||||||
| 			if (i != 0) | 			if (i != 0) | ||||||
| 				memcpy(msg, test_msg, copy_msg_len[i]); | 				memcpy(msg, test_msg, copy_msg_len[i]); | ||||||
| 			HashBuffer(j, msg, copy_msg_len[i], sum); | 			HashBuffer(j, msg, copy_msg_len[i], sum); | ||||||
|  |  | ||||||
|  | @ -946,7 +946,7 @@ errcode_t ext2fs_count_used_clusters(ext2_filsys fs, blk64_t start, | ||||||
| { | { | ||||||
| 	blk64_t		next; | 	blk64_t		next; | ||||||
| 	blk64_t		tot_set = 0; | 	blk64_t		tot_set = 0; | ||||||
| 	errcode_t	retval; | 	errcode_t	retval = 0; | ||||||
| 
 | 
 | ||||||
| 	while (start < end) { | 	while (start < end) { | ||||||
| 		retval = ext2fs_find_first_set_block_bitmap2(fs->block_map, | 		retval = ext2fs_find_first_set_block_bitmap2(fs->block_map, | ||||||
|  |  | ||||||
|  | @ -130,7 +130,7 @@ errcode_t io_channel_alloc_buf(io_channel io, int count, void *ptr) | ||||||
| 	if (count == 0) | 	if (count == 0) | ||||||
| 		size = io->block_size; | 		size = io->block_size; | ||||||
| 	else if (count > 0) | 	else if (count > 0) | ||||||
| 		size = io->block_size * count; | 		size = (size_t)io->block_size * count; | ||||||
| 	else | 	else | ||||||
| 		size = -count; | 		size = -count; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -185,12 +185,12 @@ errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num, | ||||||
| 
 | 
 | ||||||
| 		if (new_stride > MAX_STRIDE_LENGTH) | 		if (new_stride > MAX_STRIDE_LENGTH) | ||||||
| 			new_stride = MAX_STRIDE_LENGTH; | 			new_stride = MAX_STRIDE_LENGTH; | ||||||
| 		p = realloc(buf, fs->blocksize * new_stride); | 		p = realloc(buf, (size_t)fs->blocksize * new_stride); | ||||||
| 		if (!p) | 		if (!p) | ||||||
| 			return EXT2_ET_NO_MEMORY; | 			return EXT2_ET_NO_MEMORY; | ||||||
| 		buf = p; | 		buf = p; | ||||||
| 		stride_length = new_stride; | 		stride_length = new_stride; | ||||||
| 		memset(buf, 0, fs->blocksize * stride_length); | 		memset(buf, 0, (size_t)fs->blocksize * stride_length); | ||||||
| 	} | 	} | ||||||
| 	/* OK, do the write loop */ | 	/* OK, do the write loop */ | ||||||
| 	j=0; | 	j=0; | ||||||
|  |  | ||||||
|  | @ -139,7 +139,7 @@ static DWORD GetFATSizeSectors(DWORD DskSize, DWORD ReservedSecCnt, DWORD SecPer | ||||||
| 	ULONGLONG FatSz; | 	ULONGLONG FatSz; | ||||||
| 
 | 
 | ||||||
| 	Numerator = DskSize - ReservedSecCnt + ReservedClusCnt * SecPerClus; | 	Numerator = DskSize - ReservedSecCnt + ReservedClusCnt * SecPerClus; | ||||||
| 	Denominator = SecPerClus * BytesPerSect / FatElementSize + NumFATs; | 	Denominator = (ULONGLONG)SecPerClus * BytesPerSect / FatElementSize + NumFATs; | ||||||
| 	FatSz = Numerator / Denominator + 1;	// +1 to ensure we are rounded up
 | 	FatSz = Numerator / Denominator + 1;	// +1 to ensure we are rounded up
 | ||||||
| 
 | 
 | ||||||
| 	return (DWORD)FatSz; | 	return (DWORD)FatSz; | ||||||
|  |  | ||||||
|  | @ -179,7 +179,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const | ||||||
| 
 | 
 | ||||||
| 	// Check for archiso loader/entries/*.conf files
 | 	// Check for archiso loader/entries/*.conf files
 | ||||||
| 	if (safe_stricmp(psz_dirname, "/loader/entries") == 0) { | 	if (safe_stricmp(psz_dirname, "/loader/entries") == 0) { | ||||||
| 		size_t len = strlen(psz_basename); | 		len = strlen(psz_basename); | ||||||
| 		props->is_conf = ((len > 4) && (stricmp(&psz_basename[len - 5], ".conf") == 0)); | 		props->is_conf = ((len > 4) && (stricmp(&psz_basename[len - 5], ".conf") == 0)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -64,6 +64,8 @@ _cdio_strfreev(char **strv) | ||||||
|   int n; |   int n; | ||||||
| 
 | 
 | ||||||
|   cdio_assert (strv != NULL); |   cdio_assert (strv != NULL); | ||||||
|  |   if (strv == NULL) | ||||||
|  |       return; | ||||||
| 
 | 
 | ||||||
|   for(n = 0; strv[n]; n++) |   for(n = 0; strv[n]; n++) | ||||||
|     free(strv[n]); |     free(strv[n]); | ||||||
|  |  | ||||||
|  | @ -95,6 +95,9 @@ timegm(struct tm *tm) | ||||||
| static struct tm * | static struct tm * | ||||||
| gmtime_r(const time_t *timer, struct tm *result) | gmtime_r(const time_t *timer, struct tm *result) | ||||||
| { | { | ||||||
|  | #ifdef WIN32 | ||||||
|  |     return (gmtime_s(result, timer) == 0) ? result : NULL; | ||||||
|  | #else | ||||||
|     struct tm *tmp = gmtime(timer); |     struct tm *tmp = gmtime(timer); | ||||||
| 
 | 
 | ||||||
|     if (tmp) { |     if (tmp) { | ||||||
|  | @ -102,6 +105,7 @@ gmtime_r(const time_t *timer, struct tm *result) | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|     return tmp; |     return tmp; | ||||||
|  | #endif | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -109,6 +113,9 @@ gmtime_r(const time_t *timer, struct tm *result) | ||||||
| static struct tm * | static struct tm * | ||||||
| localtime_r(const time_t *timer, struct tm *result) | localtime_r(const time_t *timer, struct tm *result) | ||||||
| { | { | ||||||
|  | #ifdef WIN32 | ||||||
|  |     return (localtime_s(result, timer) == 0) ? result : NULL; | ||||||
|  | #else | ||||||
|     struct tm *tmp = localtime(timer); |     struct tm *tmp = localtime(timer); | ||||||
| 
 | 
 | ||||||
|     if (tmp) { |     if (tmp) { | ||||||
|  | @ -116,6 +123,7 @@ localtime_r(const time_t *timer, struct tm *result) | ||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|     return tmp; |     return tmp; | ||||||
|  | #endif | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										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 3.16.1817" | CAPTION "Rufus 3.16.1818" | ||||||
| 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 | ||||||
|  | @ -395,8 +395,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 3,16,1817,0 |  FILEVERSION 3,16,1818,0 | ||||||
|  PRODUCTVERSION 3,16,1817,0 |  PRODUCTVERSION 3,16,1818,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -414,13 +414,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", "3.16.1817" |             VALUE "FileVersion", "3.16.1818" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011-2021 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-3.16.exe" |             VALUE "OriginalFilename", "rufus-3.16.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.16.1817" |             VALUE "ProductVersion", "3.16.1818" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue