Skip to content

Commit

Permalink
Add checking of the response length
Browse files Browse the repository at this point in the history
  • Loading branch information
jozsefd authored and Jakuje committed Nov 19, 2021
1 parent d24afc2 commit 907a8ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libopensc/card-nqApplet.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ static int select_nqapplet(sc_card_t *card, u8 *version_major, u8 *version_minor
rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
LOG_TEST_RET(card->ctx, rv, "Card returned error");

if ( apdu.resplen < APPLET_VERSION_LEN+APPLET_MEMTYPE_LEN+APPLET_SERIALNR_LEN ) {
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_WRONG_LENGTH);
}

if ( version_major != NULL )
{
*version_major = buffer[0];
Expand Down

0 comments on commit 907a8ef

Please sign in to comment.