mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
FIX: Coverity, resource leak, and variable can't be negative,
This commit is contained in:
parent
089f91dc9d
commit
6b1111d7b8
1 changed files with 10 additions and 1 deletions
|
@ -563,6 +563,12 @@ int bruteforceFile(const char *filename, uint16_t keytable[])
|
||||||
long fsize = ftell(f);
|
long fsize = ftell(f);
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
|
if (fsize < 0) {
|
||||||
|
prnlog("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);
|
||||||
|
|
||||||
|
@ -571,7 +577,10 @@ int bruteforceFile(const char *filename, uint16_t keytable[])
|
||||||
{
|
{
|
||||||
prnlog("Error, could only read %d bytes (should be %d)",bytes_read, fsize );
|
prnlog("Error, could only read %d bytes (should be %d)",bytes_read, fsize );
|
||||||
}
|
}
|
||||||
return bruteforceDump(dump,fsize,keytable);
|
|
||||||
|
uint8_t res = bruteforceDump(dump,fsize,keytable);
|
||||||
|
free(dump);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue