Skip to content

Commit d08a0b9

Browse files
committed
iasecc: fixed possible Stack Buffer Overflow
Attribution Reported by @qp-x-qp
1 parent 04d9b35 commit d08a0b9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/libopensc/card-iasecc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,6 +3303,8 @@ iasecc_compute_signature_dst(struct sc_card *card,
33033303
LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "It's not SC_SEC_OPERATION_SIGN");
33043304
else if (!(prv->key_size & 0x1E0) || (prv->key_size & ~0x1E0))
33053305
LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Invalid key size for SC_SEC_OPERATION_SIGN");
3306+
if (sizeof(rbuf) < prv->key_size)
3307+
LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
33063308

33073309
memset(&qsign_data, 0, sizeof(qsign_data));
33083310
if (env->algorithm_flags & SC_ALGORITHM_RSA_HASH_SHA1) {

0 commit comments

Comments
 (0)