[misc] fix coverity warnings

This commit is contained in:
Pete Batard 2017-01-04 17:23:53 +00:00
parent d7e977e1f1
commit 5170706695
4 changed files with 24 additions and 11 deletions

View File

@ -5,6 +5,9 @@ set PWD=%~dp0
rmdir cov-int /s /q >NUL 2>NUL
del cov-int.zip >NUL 2>NUL
mkdir cov-int
rem *** for when/if Coverity manage to clean their act
rem cov-build --dir cov-int msbuild rufus.sln /p:Configuration=Release,Platform=x86_32 /maxcpucount
rem cov-build --dir cov-int C:\msys64\usr\bin\bash -cl "export PATH=/mingw32/bin:$PATH; cd /c/rufus; ./configure --build=i686-w64-mingw32 --host=i686-w64-mingw32 --disable-debug; make -j4"
cov-build --dir cov-int wdk_build.cmd
rem *** zip script by Peter Mortensen - http://superuser.com/a/111266/286681
echo Set objArgs = WScript.Arguments> zip.vbs

View File

@ -227,8 +227,9 @@ BOOL GetOpticalMedia(IMG_SAVE* img_save)
buffer = malloc(2048);
if ((buffer != NULL) && (SetFilePointerEx(hDrive, li, NULL, FILE_BEGIN)) &&
ReadFile(hDrive, buffer, 2048, &size, NULL) && (size == 2048)) {
safe_strcpy(label, sizeof(label), (char*)&buffer[0x28]);
for (k = safe_strlen(label) - 1; (k >= 0) && (label[k] == 0x20); k--)
memcpy(label, &buffer[0x28], sizeof(label) - 1);
label[sizeof(label) - 1] = 0;
for (k = strlen(label) - 1; (k >= 0) && (label[k] == 0x20); k--)
label[k] = 0;
img_save->Label = label;
}

View File

@ -1216,7 +1216,10 @@ static BOOL SetupWinPE(char drive_letter)
uprintf("Could not read file %s: %s\n", dst, WindowsErrorString());
goto out;
}
SetFilePointerEx(handle, liZero, NULL, FILE_BEGIN);
if (!SetFilePointerEx(handle, liZero, NULL, FILE_BEGIN)) {
uprintf("Could not rewind file %s: %s\n", dst, WindowsErrorString());
goto out;
}
// Patch setupldr.bin
uprintf("Patching file %s\n", dst);
@ -1553,13 +1556,16 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
if ((s) && (wSize == rSize))
break;
if (s)
uprintf("write error: Wrote %d bytes, expected %d bytes\n", wSize, rSize);
uprintf("write error: Wrote %d bytes, expected %d bytes", wSize, rSize);
else
uprintf("write error: %s", WindowsErrorString());
if (i < WRITE_RETRIES - 1) {
li.QuadPart = wb;
SetFilePointerEx(hPhysicalDrive, li, NULL, FILE_BEGIN);
uprintf(" RETRYING...\n");
if (!SetFilePointerEx(hPhysicalDrive, li, NULL, FILE_BEGIN)) {
uprintf("write error: could not reset position - %s", WindowsErrorString());
goto out;
}
} else {
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_WRITE_FAULT;
goto out;
@ -2136,8 +2142,11 @@ DWORD WINAPI SaveImageThread(void* param)
uprintf("write error: %s", WindowsErrorString());
if (i < WRITE_RETRIES-1) {
li.QuadPart = wb;
SetFilePointerEx(hDestImage, li, NULL, FILE_BEGIN);
uprintf(" RETRYING...\n");
if (!SetFilePointerEx(hDestImage, li, NULL, FILE_BEGIN)) {
uprintf("write error: could not reset position - %s", WindowsErrorString());
goto out;
}
} else {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
goto out;

View File

@ -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.12.1014"
CAPTION "Rufus 2.12.1015"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,12,1014,0
PRODUCTVERSION 2,12,1014,0
FILEVERSION 2,12,1015,0
PRODUCTVERSION 2,12,1015,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.12.1014"
VALUE "FileVersion", "2.12.1015"
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.12.1014"
VALUE "ProductVersion", "2.12.1015"
END
END
BLOCK "VarFileInfo"