Proposed fix for #723

This commit is contained in:
Thomas König 2016-03-29 17:36:01 +02:00 committed by Viktor Tarasov
parent 972a93ab47
commit a3e7ebec42
1 changed files with 5 additions and 0 deletions

View File

@ -546,6 +546,11 @@ static int sc_hsm_compute_signature(sc_card_t *card,
LOG_FUNC_RETURN(card->ctx, SC_ERROR_OBJECT_NOT_FOUND);
}
// check if datalen exceeds the buffer size
if (datalen > SC_MAX_APDU_BUFFER_SIZE) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS);
}
sc_format_apdu(card, &apdu, SC_APDU_CASE_4, 0x68, priv->env->key_ref[0], priv->algorithm);
apdu.cla = 0x80;
apdu.resp = rbuf;