mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-22 02:45:11 -04:00
[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:
parent
fdfc9ff82d
commit
7c142fadbc
12 changed files with 93 additions and 78 deletions
17
src/dev.c
17
src/dev.c
|
@ -32,6 +32,7 @@
|
|||
#include <inttypes.h>
|
||||
#include <commctrl.h>
|
||||
#include <setupapi.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "rufus.h"
|
||||
#include "missing.h"
|
||||
|
@ -452,16 +453,12 @@ BOOL GetDevices(DWORD devnum)
|
|||
if (strcmp(genstor_name[s], "SD") == 0)
|
||||
card_start = s;
|
||||
}
|
||||
// Overkill, but better safe than sorry. And yeah, we could have used
|
||||
// arrays of arrays to avoid this, but it's more readable this way.
|
||||
if ((uasp_start <= 0) || (uasp_start >= ARRAYSIZE(usbstor_name))) {
|
||||
uprintf("Spock gone crazy error in %s:%d", __FILE__, __LINE__);
|
||||
goto out;
|
||||
}
|
||||
if ((card_start <= 0) || (card_start >= ARRAYSIZE(genstor_name))) {
|
||||
uprintf("Spock gone crazy error in %s:%d", __FILE__, __LINE__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Better safe than sorry. And yeah, we could have used arrays of
|
||||
// arrays to avoid this, but it's more readable this way.
|
||||
assert((uasp_start > 0) && (uasp_start < ARRAYSIZE(usbstor_name)));
|
||||
assert((card_start > 0) && (card_start < ARRAYSIZE(genstor_name)));
|
||||
|
||||
devid_list = NULL;
|
||||
if (full_list_size != 0) {
|
||||
full_list_size += 1; // add extra NUL terminator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue