mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 12:59:44 -07:00
FIX, Coverity, Argument can't be negative. CID# 212322, ftell(f) can …
…be negative. Not allowed in malloc... from iceman1001
This commit is contained in:
parent
7a616c0d70
commit
eb5b63b4a6
1 changed files with 7 additions and 0 deletions
|
@ -285,6 +285,7 @@ int CmdHFiClassELoad(const char *Cmd) {
|
||||||
|
|
||||||
if (fsize < 0) {
|
if (fsize < 0) {
|
||||||
PrintAndLog("Error, when getting filesize");
|
PrintAndLog("Error, when getting filesize");
|
||||||
|
fclose(f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1506,6 +1507,12 @@ static int loadKeys(char *filename) {
|
||||||
long fsize = ftell(f);
|
long fsize = ftell(f);
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
|
if ( fsize < 0 ) {
|
||||||
|
PrintAndLog("Error, when getting filesize");
|
||||||
|
fclose(f);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *dump = malloc(fsize);
|
uint8_t *dump = malloc(fsize);
|
||||||
|
|
||||||
size_t bytes_read = fread(dump, 1, fsize, f);
|
size_t bytes_read = fread(dump, 1, fsize, f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue