[net] improve handling of invalid signatures

* Also make bPromptOnError an actual parameter to the download function calls
* Also prefer the use of assert() to custom assertion messages
This commit is contained in:
Pete Batard 2018-06-30 22:45:15 +01:00
parent fdfc9ff82d
commit 7c142fadbc
12 changed files with 93 additions and 78 deletions

View file

@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "rufus.h"
#include "missing.h"
@ -109,11 +110,9 @@ BOOL GetAutoMount(BOOL* enabled)
* clear the MBR of!), so we mitigate the risk by forcing our indexes to belong to
* the specific range [DRIVE_INDEX_MIN; DRIVE_INDEX_MAX].
*/
#define CheckDriveIndex(DriveIndex) do { \
if ((DriveIndex < DRIVE_INDEX_MIN) || (DriveIndex > DRIVE_INDEX_MAX)) { \
uprintf("ERROR: Bad index value %d. Please check the code!", DriveIndex); \
goto out; \
} \
#define CheckDriveIndex(DriveIndex) do { \
assert((DriveIndex >= DRIVE_INDEX_MIN) && (DriveIndex <= DRIVE_INDEX_MAX)); \
if ((DriveIndex < DRIVE_INDEX_MIN) || (DriveIndex > DRIVE_INDEX_MAX)) goto out; \
DriveIndex -= DRIVE_INDEX_MIN; } while (0)
/*