mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] fix Coverity warnings
This commit is contained in:
parent
3622b441ed
commit
0a3c04379b
4 changed files with 24 additions and 23 deletions
|
@ -1,7 +1,7 @@
|
||||||
@rem *** Internal developer script to run Coverity ***
|
@rem *** Internal developer script to run Coverity ***
|
||||||
@echo off
|
@echo off
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
|
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 PATH=%PATH%;%COV_DIR%\bin
|
||||||
set PWD=%~dp0
|
set PWD=%~dp0
|
||||||
set TARGET=x86_32
|
set TARGET=x86_32
|
||||||
|
|
|
@ -124,6 +124,7 @@ static errcode_t bb_u64_list_add(bb_u64_list bb, uint64_t blk)
|
||||||
bb->size -= 100;
|
bb->size -= 100;
|
||||||
return BB_ET_NO_MEMORY;
|
return BB_ET_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
// coverity[suspicious_sizeof]
|
||||||
memset(&bb->list[bb->size-100], 0, 100 * sizeof(uint64_t));
|
memset(&bb->list[bb->size-100], 0, 100 * sizeof(uint64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
src/rufus.c
22
src/rufus.c
|
@ -2152,9 +2152,9 @@ static void SaveISO(void)
|
||||||
static BOOL CheckDriveAccess(DWORD dwTimeOut)
|
static BOOL CheckDriveAccess(DWORD dwTimeOut)
|
||||||
{
|
{
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
BOOL bProceed = TRUE;
|
BOOL ret = FALSE, proceed = TRUE;
|
||||||
BYTE access_mask;
|
BYTE access_mask;
|
||||||
char *PhysicalPath, DevPath[MAX_PATH];
|
char *PhysicalPath = NULL, DevPath[MAX_PATH];
|
||||||
char drive_letter[27], drive_name[] = "?:";
|
char drive_letter[27], drive_name[] = "?:";
|
||||||
char *message, title[128];
|
char *message, title[128];
|
||||||
DWORD cur_time, end_time = GetTickCount() + dwTimeOut;
|
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
|
// Search for any blocking processes against the physical drive
|
||||||
PhysicalPath = GetPhysicalName(DeviceNum);
|
PhysicalPath = GetPhysicalName(DeviceNum);
|
||||||
QueryDosDeviceA(&PhysicalPath[4], DevPath, sizeof(DevPath));
|
if (QueryDosDeviceA(&PhysicalPath[4], DevPath, sizeof(DevPath)) != 0) {
|
||||||
access_mask = SearchProcess(DevPath, dwTimeOut, TRUE, TRUE, TRUE);
|
access_mask = SearchProcess(DevPath, dwTimeOut, TRUE, TRUE, TRUE);
|
||||||
CHECK_FOR_USER_CANCEL;
|
CHECK_FOR_USER_CANCEL;
|
||||||
if (access_mask != 0) {
|
if (access_mask != 0) {
|
||||||
bProceed = FALSE;
|
proceed = FALSE;
|
||||||
uprintf("Found potentially blocking process(es) against %s:", &PhysicalPath[4]);
|
uprintf("Found potentially blocking process(es) against %s:", &PhysicalPath[4]);
|
||||||
for (j = 0; j < BlockingProcess.Index; j++)
|
for (j = 0; j < BlockingProcess.Index; j++)
|
||||||
uprintf(BlockingProcess.String[j]);
|
uprintf(BlockingProcess.String[j]);
|
||||||
}
|
}
|
||||||
free(PhysicalPath);
|
}
|
||||||
|
|
||||||
// Search for any blocking processes against the logical volume(s)
|
// Search for any blocking processes against the logical volume(s)
|
||||||
GetDriveLetters(DeviceNum, drive_letter);
|
GetDriveLetters(DeviceNum, drive_letter);
|
||||||
|
@ -2194,7 +2194,7 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut)
|
||||||
CHECK_FOR_USER_CANCEL;
|
CHECK_FOR_USER_CANCEL;
|
||||||
// Ignore if all we have is read-only
|
// Ignore if all we have is read-only
|
||||||
if ((access_mask & 0x06) || (access_mask == 0x80)) {
|
if ((access_mask & 0x06) || (access_mask == 0x80)) {
|
||||||
bProceed = FALSE;
|
proceed = FALSE;
|
||||||
uprintf("Found potentially blocking process(es) against %s", drive_name);
|
uprintf("Found potentially blocking process(es) against %s", drive_name);
|
||||||
for (j = 0; j < BlockingProcess.Index; j++)
|
for (j = 0; j < BlockingProcess.Index; j++)
|
||||||
uprintf(BlockingProcess.String[j]);
|
uprintf(BlockingProcess.String[j]);
|
||||||
|
@ -2203,21 +2203,21 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prompt the user if we detected blocking processes
|
// 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
|
// 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?"
|
message = GetMuiString("shell32.dll", 28701); // "This drive is in use (...) Do you want to format it anyway?"
|
||||||
if (message != NULL) {
|
if (message != NULL) {
|
||||||
ComboBox_GetTextU(hDeviceList, title, sizeof(title));
|
ComboBox_GetTextU(hDeviceList, title, sizeof(title));
|
||||||
bProceed = Notification(MSG_WARNING_QUESTION, NULL, title, message);
|
proceed = Notification(MSG_WARNING_QUESTION, NULL, title, message);
|
||||||
free(message);
|
free(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ret = proceed;
|
||||||
|
|
||||||
PrintInfo(0, MSG_210);
|
|
||||||
return bProceed;
|
|
||||||
out:
|
out:
|
||||||
PrintInfo(0, MSG_210);
|
PrintInfo(0, MSG_210);
|
||||||
return FALSE;
|
free(PhysicalPath);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RUFUS_TEST
|
#ifdef RUFUS_TEST
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||||
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 2.16.1159"
|
CAPTION "Rufus 2.16.1160"
|
||||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||||
|
@ -366,8 +366,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,16,1159,0
|
FILEVERSION 2,16,1160,0
|
||||||
PRODUCTVERSION 2,16,1159,0
|
PRODUCTVERSION 2,16,1160,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -384,13 +384,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "2.16.1159"
|
VALUE "FileVersion", "2.16.1160"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus.exe"
|
VALUE "OriginalFilename", "rufus.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "2.16.1159"
|
VALUE "ProductVersion", "2.16.1160"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue