[misc] fix Coverity warnings

* What would be nicer was if half these Coverity issues weren't false positives...
* Also update Readme and fix progress bar colour not being reset after error
This commit is contained in:
Pete Batard 2019-03-15 10:57:17 +00:00
parent 6252636aff
commit efd6d9f345
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
5 changed files with 18 additions and 12 deletions

View File

@ -17,6 +17,7 @@ Features
* Create bootable drives from bootable ISOs (Windows, Linux, etc.)
* Create bootable drives from bootable disk images, including compressed ones
* Create [Windows To Go](https://en.wikipedia.org/wiki/Windows_To_Go) drives
* Download official Microsoft Windows 8 or Windows 10 retail ISOs
* Compute MD5, SHA-1 and SHA-256 checksums of the selected image
* Twice as fast as Microsoft's USB/DVD tool or UNetbootin, on ISO -> USB creation <sup>(1)</sup>
* Perform bad blocks checks, including detection of "fake" flash drives

View File

@ -224,12 +224,14 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t file_length, const
}
// Check for "install.###" in "###/sources/"
if (safe_stricmp(&psz_dirname[max(0, safe_strlen(psz_dirname) - strlen(sources_str))], sources_str) == 0) {
for (i = 0; i < ARRAYSIZE(wininst_name); i++) {
if (safe_stricmp(psz_basename, wininst_name[i]) == 0) {
if (img_report.wininst_index < MAX_WININST) {
static_sprintf(img_report.wininst_path[img_report.wininst_index], "?:%s", psz_fullpath);
img_report.wininst_index++;
if (psz_dirname != NULL) {
if (safe_stricmp(&psz_dirname[max(0, ((int)safe_strlen(psz_dirname)) - ((int)strlen(sources_str)))], sources_str) == 0) {
for (i = 0; i < ARRAYSIZE(wininst_name); i++) {
if (safe_stricmp(psz_basename, wininst_name[i]) == 0) {
if (img_report.wininst_index < MAX_WININST) {
static_sprintf(img_report.wininst_path[img_report.wininst_index], "?:%s", psz_fullpath);
img_report.wininst_index++;
}
}
}
}

View File

@ -872,7 +872,7 @@ BOOL CheckForUpdates(BOOL force)
*/
static DWORD WINAPI DownloadISOThread(LPVOID param)
{
char locale_str[1024], cmdline[sizeof(locale_str) + 512], pipe[64] = "\\\\.\\pipe\\";
char locale_str[1024], cmdline[sizeof(locale_str) + 512], pipe[MAX_GUID_STRING_LENGTH + 16] = "\\\\.\\pipe\\";
char powershell_path[MAX_PATH], icon_path[MAX_PATH] = "", script_path[MAX_PATH] = "";
char *url = NULL, sig_url[128];
BYTE *sig = NULL;
@ -886,6 +886,7 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
// may either spam our pipe or replace our script to fool antivirus solutions into
// thinking that Rufus is doing something malicious...
IGNORE_RETVAL(CoCreateGuid(&guid));
// coverity[fixed_size_dest]
strcpy(&pipe[9], GuidToString(&guid));
static_sprintf(icon_path, "%s%s.ico", temp_dir, APPLICATION_NAME);
ExtractAppIcon(icon_path, TRUE);

View File

@ -2519,6 +2519,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
case UM_PROGRESS_INIT:
isMarquee = (wParam == PBS_MARQUEE);
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_NORMAL, 0);
if (isMarquee)
SendMessage(hProgress, PBM_SETMARQUEE, TRUE, 0);
else
@ -2847,6 +2848,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
pfSetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);
uprintf("*** " APPLICATION_NAME " init ***\n");
// coverity[pointless_string_compare]
is_x86_32 = (strcmp(APPLICATION_ARCH, "x86") == 0);
// We have to process the arguments before we acquire the lock and process the locale

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.5.1469"
CAPTION "Rufus 3.5.1470"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -394,8 +394,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,5,1469,0
PRODUCTVERSION 3,5,1469,0
FILEVERSION 3,5,1470,0
PRODUCTVERSION 3,5,1470,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -413,13 +413,13 @@ BEGIN
VALUE "Comments", "https://akeo.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.5.1469"
VALUE "FileVersion", "3.5.1470"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus-3.5.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.5.1469"
VALUE "ProductVersion", "3.5.1470"
END
END
BLOCK "VarFileInfo"