idprime: Fix null-dereference

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21586
This commit is contained in:
Jakub Jelen 2020-04-06 12:28:13 +02:00 committed by Frank Morgner
parent 1ddef2cd15
commit 7893d2860c
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ static int idprime_select_index(sc_card_t *card)
}
sc_file_free(file);
/* Ignore too large files */
if (r > MAX_FILE_SIZE) {
if (r <= 0 || r > MAX_FILE_SIZE) {
r = SC_ERROR_INVALID_DATA;
}
return r;