fixed 123497 Dereference after null check

Thanks to Coverity Scan
This commit is contained in:
Frank Morgner 2020-01-31 22:08:10 +01:00
parent 5475dbcb3c
commit 3687f71bf7
1 changed files with 6 additions and 4 deletions

View File

@ -255,11 +255,13 @@ static int gids_get_DO(sc_card_t* card, int fileIdentifier, int dataObjectIdenti
if (!p) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_FILE_NOT_FOUND);
}
if (datasize > *responselen) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_BUFFER_TOO_SMALL);
if (response && responselen) {
if (datasize > *responselen) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_BUFFER_TOO_SMALL);
}
memcpy(response, p, datasize);
*responselen = datasize;
}
memcpy(response, p, datasize);
*responselen = datasize;
return SC_SUCCESS;
}