mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-19 05:33:17 +08:00
FIX, Coverity, Argument can't be negative, CID #212324, ftell(f) can be negative, not allowed in malloc.
This commit is contained in:
parent
4bb17c6633
commit
ddb748a973
1 changed files with 6 additions and 1 deletions
|
@ -1316,8 +1316,13 @@ int CmdHFiClassReadTagFile(const char *Cmd) {
|
||||||
long fsize = ftell(f);
|
long fsize = ftell(f);
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
uint8_t *dump = malloc(fsize);
|
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);
|
size_t bytes_read = fread(dump, 1, fsize, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Reference in a new issue