Added additional checks to the from load dictionary returned data points.
This commit is contained in:
@@ -2128,17 +2128,10 @@ static int CmdT55xxChkPwds(const char *Cmd) {
|
||||
if (use_pwd_file) {
|
||||
uint16_t keycount = 0;
|
||||
|
||||
// TODO, a way of reallocating memory if file was larger
|
||||
keyBlock = calloc(4 * 200, sizeof(uint8_t));
|
||||
if (keyBlock == NULL) {
|
||||
PrintAndLogEx(ERR, "error, cannot allocate memory ");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
int res = loadFileDICTIONARY_safe(filename, &keyBlock, 4, &keycount);
|
||||
if (res || keycount == 0) {
|
||||
if (res || keycount == 0 || keyBlock == NULL) {
|
||||
PrintAndLogEx(WARNING, "No keys found in file");
|
||||
free(keyBlock);
|
||||
if (keyBlock != NULL) free(keyBlock);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user