mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[misc] fix some Coverity warnings
This commit is contained in:
		
							parent
							
								
									436584fcc0
								
							
						
					
					
						commit
						8538ce0590
					
				
					 7 changed files with 14 additions and 9 deletions
				
			
		|  | @ -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.15.1810.0" /> |     Version="3.15.1811.0" /> | ||||||
| 
 | 
 | ||||||
|   <Properties> |   <Properties> | ||||||
|     <DisplayName>Rufus</DisplayName> |     <DisplayName>Rufus</DisplayName> | ||||||
|  |  | ||||||
|  | @ -119,7 +119,7 @@ uint32_t* crc32_filltable(uint32_t *crc_table, int endian) | ||||||
| { | { | ||||||
| 	/* Expects the caller to do the cleanup */ | 	/* Expects the caller to do the cleanup */ | ||||||
| 	if (!crc_table) | 	if (!crc_table) | ||||||
| 		crc_table = malloc((1 << CRC_LE_BITS) * sizeof(uint32_t)); | 		crc_table = calloc(1 << CRC_LE_BITS, sizeof(uint32_t)); | ||||||
| 	if (crc_table) { | 	if (crc_table) { | ||||||
| 		if (endian) | 		if (endian) | ||||||
| 			crc32init_be(crc_table); | 			crc32init_be(crc_table); | ||||||
|  |  | ||||||
|  | @ -191,6 +191,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle) | ||||||
| 		 * it has lchmod which seems to do nothing! | 		 * it has lchmod which seems to do nothing! | ||||||
| 		 * so we use chmod... */ | 		 * so we use chmod... */ | ||||||
| 		if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_PERM)) { | 		if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_PERM)) { | ||||||
|  | 			// coverity[toctou]
 | ||||||
| 			(void)_chmod(file_header->name, file_header->mode); | 			(void)_chmod(file_header->name, file_header->mode); | ||||||
| 		} | 		} | ||||||
| 		if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) { | 		if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) { | ||||||
|  |  | ||||||
|  | @ -1526,9 +1526,11 @@ BOOL DumpFatDir(const char* path, int32_t cluster) | ||||||
| 				written = 0; | 				written = 0; | ||||||
| 				s = libfat_clustertosector(lf_fs, dirpos.cluster); | 				s = libfat_clustertosector(lf_fs, dirpos.cluster); | ||||||
| 				while ((s != 0) && (s < 0xFFFFFFFFULL) && (written < diritem.size)) { | 				while ((s != 0) && (s < 0xFFFFFFFFULL) && (written < diritem.size)) { | ||||||
|  | 					buf = libfat_get_sector(lf_fs, s); | ||||||
|  | 					if (buf == NULL) | ||||||
|  | 						FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_SECTOR_NOT_FOUND; | ||||||
| 					if (FormatStatus) | 					if (FormatStatus) | ||||||
| 						goto out; | 						goto out; | ||||||
| 					buf = libfat_get_sector(lf_fs, s); |  | ||||||
| 					size = MIN(LIBFAT_SECTOR_SIZE, diritem.size - written); | 					size = MIN(LIBFAT_SECTOR_SIZE, diritem.size - written); | ||||||
| 					if (!WriteFileWithRetry(handle, buf, size, &size, WRITE_RETRIES) || | 					if (!WriteFileWithRetry(handle, buf, size, &size, WRITE_RETRIES) || | ||||||
| 						(size != MIN(LIBFAT_SECTOR_SIZE, diritem.size - written))) { | 						(size != MIN(LIBFAT_SECTOR_SIZE, diritem.size - written))) { | ||||||
|  |  | ||||||
|  | @ -283,6 +283,7 @@ BOOL get_supported_locales(const char* filename) | ||||||
| 		if ((line[i] != 'l') && (line[i] != 'v') && (line[i] != 'a')) | 		if ((line[i] != 'l') && (line[i] != 'v') && (line[i] != 'a')) | ||||||
| 			continue; | 			continue; | ||||||
| 		// line[i] is not NUL so i+1 is safe to access
 | 		// line[i] is not NUL so i+1 is safe to access
 | ||||||
|  | 		// coverity[tainted_data]
 | ||||||
| 		lcmd = get_loc_cmd(line[i], &line[i+1]); | 		lcmd = get_loc_cmd(line[i], &line[i+1]); | ||||||
| 		if ((lcmd == NULL) || ((lcmd->command != LC_LOCALE) && (lcmd->command != LC_VERSION) && (lcmd->command != LC_ATTRIBUTES))) { | 		if ((lcmd == NULL) || ((lcmd->command != LC_LOCALE) && (lcmd->command != LC_VERSION) && (lcmd->command != LC_ATTRIBUTES))) { | ||||||
| 			free_loc_cmd(lcmd); | 			free_loc_cmd(lcmd); | ||||||
|  | @ -446,6 +447,7 @@ BOOL get_loc_data_file(const char* filename, loc_cmd* lcmd) | ||||||
| 			buf[i] = 0; | 			buf[i] = 0; | ||||||
| 			if (!eol) | 			if (!eol) | ||||||
| 				loc_line_nr += line_nr_incr; | 				loc_line_nr += line_nr_incr; | ||||||
|  | 			// coverity[tainted_data]
 | ||||||
| 			get_loc_data_line(buf); | 			get_loc_data_line(buf); | ||||||
| 			break; | 			break; | ||||||
| 		case '\r': | 		case '\r': | ||||||
|  |  | ||||||
|  | @ -3137,7 +3137,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine | ||||||
| 	BOOL disable_hogger = FALSE, previous_enable_HDDs = FALSE, vc = IsRegistryNode(REGKEY_HKCU, vs_reg); | 	BOOL disable_hogger = FALSE, previous_enable_HDDs = FALSE, vc = IsRegistryNode(REGKEY_HKCU, vs_reg); | ||||||
| 	BOOL alt_pressed = FALSE, alt_command = FALSE; | 	BOOL alt_pressed = FALSE, alt_command = FALSE; | ||||||
| 	BYTE *loc_data; | 	BYTE *loc_data; | ||||||
| 	DWORD loc_size, u, size = sizeof(u); | 	DWORD loc_size, u = 0, size = sizeof(u); | ||||||
| 	char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH] = "", ini_flags[] = "rb"; | 	char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH] = "", ini_flags[] = "rb"; | ||||||
| 	char *tmp, *locale_name = NULL, **argv = NULL; | 	char *tmp, *locale_name = NULL, **argv = NULL; | ||||||
| 	wchar_t **wenv, **wargv; | 	wchar_t **wenv, **wargv; | ||||||
|  |  | ||||||
							
								
								
									
										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.15.1810" | CAPTION "Rufus 3.15.1811" | ||||||
| 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,15,1810,0 |  FILEVERSION 3,15,1811,0 | ||||||
|  PRODUCTVERSION 3,15,1810,0 |  PRODUCTVERSION 3,15,1811,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.15.1810" |             VALUE "FileVersion", "3.15.1811" | ||||||
|             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.15.exe" |             VALUE "OriginalFilename", "rufus-3.15.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "3.15.1810" |             VALUE "ProductVersion", "3.15.1811" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue