From 84427d12dd2db477b7075d90f871ed22ddfa619d Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 5 Aug 2019 20:18:34 +0100 Subject: [PATCH] [core] add an exception for JMicron flash drives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Also fix another round of Coverity trigger-happy warnings (Seriously, those FALSE POSITIVES about fwprintf can £$%^&* off — fix your frigging detection, Synopsys!) --- src/dos.c | 2 +- src/ext2fs/initialize.c | 4 ++++ src/hdd_vs_ufd.h | 4 +++- src/icon.c | 4 ++-- src/msapi_utf8.h | 1 + src/parser.c | 8 ++++---- src/rufus.rc | 10 +++++----- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/dos.c b/src/dos.c index c73b17ce..1235e943 100644 --- a/src/dos.c +++ b/src/dos.c @@ -216,7 +216,7 @@ static BOOL ExtractFAT(int entry, const char* path) uprintf("invalid path supplied for MS-DOS FAT extraction\n"); return FALSE; } - strcpy(filename, path); + static_strcpy(filename, path); pos = strlen(path); fnamepos = pos; diff --git a/src/ext2fs/initialize.c b/src/ext2fs/initialize.c index ea263c2b..b887cc85 100644 --- a/src/ext2fs/initialize.c +++ b/src/ext2fs/initialize.c @@ -293,6 +293,10 @@ retry: ext2fs_has_feature_64bit(super) ? EXT2_MIN_DESC_SIZE_64BIT : 0); + if (EXT2_DESC_SIZE(super) == 0) { + retval = EXT2_ET_UNEXPECTED_BLOCK_SIZE; + goto cleanup; + } fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count, EXT2_DESC_PER_BLOCK(super)); diff --git a/src/hdd_vs_ufd.h b/src/hdd_vs_ufd.h index 669372bd..dff47ec3 100644 --- a/src/hdd_vs_ufd.h +++ b/src/hdd_vs_ufd.h @@ -280,7 +280,9 @@ static vidpid_score_t vidpid_score[] = { { 0x0930, 0x6544, -20 }, { 0x0930, 0x6545, -20 }, // Innostor exceptions - { 0x0BC2, 0x03312, -20 }, + { 0x0bc2, 0x3312, -20 }, + // JMicron exceptions + { 0x152d, 0x0901, -20 }, // Verbatim exceptions { 0x18a5, 0x0243, -20 }, { 0x18a5, 0x0245, -20 }, diff --git a/src/icon.c b/src/icon.c index 8c2cfd7e..9f30d1b8 100644 --- a/src/icon.c +++ b/src/icon.c @@ -177,8 +177,8 @@ BOOL SetAutorun(const char* path) GetWindowTextW(hLabel, wlabel, ARRAYSIZE(wlabel)); GetWindowTextW(hMainDialog, wRufusVersion, ARRAYSIZE(wRufusVersion)); - fwprintf(fd, L"; Created by %s\n; " LTEXT(RUFUS_URL) L"\n", wRufusVersion); - fwprintf(fd, L"[autorun]\nicon = autorun.ico\nlabel = %s\n", wlabel); + fwprintf_s(fd, L"; Created by %s\n; " LTEXT(RUFUS_URL) L"\n", wRufusVersion); + fwprintf_s(fd, L"[autorun]\nicon = autorun.ico\nlabel = %s\n", wlabel); fclose(fd); uprintf("Created: %s", filename); diff --git a/src/msapi_utf8.h b/src/msapi_utf8.h index 740c75de..3ff15d95 100644 --- a/src/msapi_utf8.h +++ b/src/msapi_utf8.h @@ -336,6 +336,7 @@ static __inline int GetWindowTextU(HWND hWnd, char* lpString, int nMaxCount) walloc(lpString, nMaxCount); ret = GetWindowTextW(hWnd, wlpString, nMaxCount); err = GetLastError(); + // coverity[var_deref_model] if ( (ret != 0) && ((ret = wchar_to_utf8_no_alloc(wlpString, lpString, nMaxCount)) == 0) ) { err = GetLastError(); } diff --git a/src/parser.c b/src/parser.c index c4073046..fd14b3a9 100644 --- a/src/parser.c +++ b/src/parser.c @@ -782,13 +782,13 @@ char* set_token_data_file(const char* token, const char* data, const char* filen fputws(buf, fd_out); // Now output the new data - fwprintf(fd_out, L"%s\n", wdata); + fwprintf_s(fd_out, L"%s\n", wdata); ret = (char*)data; } if (ret == NULL) { // Didn't find an existing token => append it - fwprintf(fd_out, L"%s = %s\n", wtoken, wdata); + fwprintf_s(fd_out, L"%s = %s\n", wtoken, wdata); ret = (char*)data; } @@ -1039,7 +1039,7 @@ char* insert_section_data(const char* filename, const char* section, const char* // Section was found, output it fputws(buf, fd_out); // Now output the new data - fwprintf(fd_out, L"%s\n", wdata); + fwprintf_s(fd_out, L"%s\n", wdata); ret = (char*)data; } @@ -1194,7 +1194,7 @@ char* replace_in_token_data(const char* filename, const char* token, const char* i = (torep-buf) + wcslen(wsrc); *torep = 0; - fwprintf(fd_out, L"%s%s%s", buf, wrep, &buf[i]); + fwprintf_s(fd_out, L"%s%s%s", buf, wrep, &buf[i]); ret = (char*)rep; } diff --git a/src/rufus.rc b/src/rufus.rc index cc8d6030..42bce0f0 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -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.7.1555" +CAPTION "Rufus 3.7.1556" 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,7,1555,0 - PRODUCTVERSION 3,7,1555,0 + FILEVERSION 3,7,1556,0 + PRODUCTVERSION 3,7,1556,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.7.1555" + VALUE "FileVersion", "3.7.1556" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2019 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus-3.7.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.7.1555" + VALUE "ProductVersion", "3.7.1556" END END BLOCK "VarFileInfo"