mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
FIX: Coverity , Argument can't be negative, CID #121323, ftell(f) can be negative, not allowed in malloc.
FIX: forgot to close the filehandle :(
This commit is contained in:
parent
9c4e28a445
commit
4bb17c6633
1 changed files with 7 additions and 1 deletions
|
@ -286,10 +286,10 @@ int CmdHFiClassELoad(const char *Cmd) {
|
|||
|
||||
if (fsize < 0) {
|
||||
prnlog("Error, when getting filesize");
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t *dump = malloc(fsize);
|
||||
|
||||
size_t bytes_read = fread(dump, 1, fsize, f);
|
||||
|
@ -1509,6 +1509,12 @@ static int loadKeys(char *filename) {
|
|||
long fsize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
if ( fsize < 0 ) {
|
||||
PrintAndLog("Error, when getting filesize");
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t *dump = malloc(fsize);
|
||||
|
||||
size_t bytes_read = fread(dump, 1, fsize, f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue