coolkey: Avoid success from init if there are no reasonable data raturned

Thanks to oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18918
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18915
This commit is contained in:
Jakub Jelen 2019-11-14 10:53:01 +01:00 committed by Frank Morgner
parent 75847f4e93
commit 2c68c0662c
1 changed files with 4 additions and 0 deletions

View File

@ -2215,6 +2215,10 @@ static int coolkey_initialize(sc_card_t *card)
r = coolkey_list_object(card, COOLKEY_LIST_NEXT, &object_info);
}
if (r != SC_ERROR_FILE_END_REACHED) {
/* This means the card does not cooperate at all: bail out */
if (r >= 0) {
r = SC_ERROR_INVALID_CARD;
}
goto cleanup;
}
/* if we didn't pull the cuid from the combined object, then grab it now */