fixed Global-buffer-overflow READ 1

https://oss-fuzz.com/testcase-detail/5685978287308800
Thanks to OSS-Fuzz
This commit is contained in:
Frank Morgner 2019-11-06 23:08:43 +01:00
parent 8fea658fe9
commit 1a069ca71e
1 changed files with 3 additions and 0 deletions

View File

@ -388,6 +388,9 @@ static int select_item(sc_card_t *card, const sc_path_t *path_in, sc_file_t ** f
fs->currentFile[0] = oid[2];
fs->currentFile[1] = oid[3];
} else {
if(pathlen < 2) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS);
}
fs->currentPath[0] = oid[pathlen - 2];
fs->currentPath[1] = oid[pathlen - 1];
fs->currentFile[0] = 0;