diff --git a/_coverity.cmd b/_coverity.cmd index 5c7c412b..80c2c6fa 100644 --- a/_coverity.cmd +++ b/_coverity.cmd @@ -1,7 +1,7 @@ @rem *** Internal developer script to run Coverity *** @echo off call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -set COV_DIR=D:\cov-analysis-win64-8.7.0 +set COV_DIR=D:\cov-analysis-win64-2017.07 set PATH=%PATH%;%COV_DIR%\bin set PWD=%~dp0 set TARGET=x86_32 diff --git a/src/badblocks.c b/src/badblocks.c index 94a8d731..02318a05 100644 --- a/src/badblocks.c +++ b/src/badblocks.c @@ -124,6 +124,7 @@ static errcode_t bb_u64_list_add(bb_u64_list bb, uint64_t blk) bb->size -= 100; return BB_ET_NO_MEMORY; } + // coverity[suspicious_sizeof] memset(&bb->list[bb->size-100], 0, 100 * sizeof(uint64_t)); } diff --git a/src/rufus.c b/src/rufus.c index 8dda3329..6cb773da 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -2152,9 +2152,9 @@ static void SaveISO(void) static BOOL CheckDriveAccess(DWORD dwTimeOut) { uint32_t i, j; - BOOL bProceed = TRUE; + BOOL ret = FALSE, proceed = TRUE; BYTE access_mask; - char *PhysicalPath, DevPath[MAX_PATH]; + char *PhysicalPath = NULL, DevPath[MAX_PATH]; char drive_letter[27], drive_name[] = "?:"; char *message, title[128]; DWORD cur_time, end_time = GetTickCount() + dwTimeOut; @@ -2170,16 +2170,16 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut) // Search for any blocking processes against the physical drive PhysicalPath = GetPhysicalName(DeviceNum); - QueryDosDeviceA(&PhysicalPath[4], DevPath, sizeof(DevPath)); - access_mask = SearchProcess(DevPath, dwTimeOut, TRUE, TRUE, TRUE); - CHECK_FOR_USER_CANCEL; - if (access_mask != 0) { - bProceed = FALSE; - uprintf("Found potentially blocking process(es) against %s:", &PhysicalPath[4]); - for (j = 0; j < BlockingProcess.Index; j++) - uprintf(BlockingProcess.String[j]); + if (QueryDosDeviceA(&PhysicalPath[4], DevPath, sizeof(DevPath)) != 0) { + access_mask = SearchProcess(DevPath, dwTimeOut, TRUE, TRUE, TRUE); + CHECK_FOR_USER_CANCEL; + if (access_mask != 0) { + proceed = FALSE; + uprintf("Found potentially blocking process(es) against %s:", &PhysicalPath[4]); + for (j = 0; j < BlockingProcess.Index; j++) + uprintf(BlockingProcess.String[j]); + } } - free(PhysicalPath); // Search for any blocking processes against the logical volume(s) GetDriveLetters(DeviceNum, drive_letter); @@ -2194,7 +2194,7 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut) CHECK_FOR_USER_CANCEL; // Ignore if all we have is read-only if ((access_mask & 0x06) || (access_mask == 0x80)) { - bProceed = FALSE; + proceed = FALSE; uprintf("Found potentially blocking process(es) against %s", drive_name); for (j = 0; j < BlockingProcess.Index; j++) uprintf(BlockingProcess.String[j]); @@ -2203,21 +2203,21 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut) } // Prompt the user if we detected blocking processes - if (!bProceed) { + if (!proceed) { // We'll use a system translated string instead of one from rufus.loc message = GetMuiString("shell32.dll", 28701); // "This drive is in use (...) Do you want to format it anyway?" if (message != NULL) { ComboBox_GetTextU(hDeviceList, title, sizeof(title)); - bProceed = Notification(MSG_WARNING_QUESTION, NULL, title, message); + proceed = Notification(MSG_WARNING_QUESTION, NULL, title, message); free(message); } } + ret = proceed; - PrintInfo(0, MSG_210); - return bProceed; out: PrintInfo(0, MSG_210); - return FALSE; + free(PhysicalPath); + return ret; } #ifdef RUFUS_TEST diff --git a/src/rufus.rc b/src/rufus.rc index 65203137..b9444533 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 2.16.1159" +CAPTION "Rufus 2.16.1160" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -366,8 +366,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,16,1159,0 - PRODUCTVERSION 2,16,1159,0 + FILEVERSION 2,16,1160,0 + PRODUCTVERSION 2,16,1160,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -384,13 +384,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.16.1159" + VALUE "FileVersion", "2.16.1160" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.16.1159" + VALUE "ProductVersion", "2.16.1160" END END BLOCK "VarFileInfo"