oberthur: fixed Heap-buffer-overflow
fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32149
This commit is contained in:
parent
fc0df4e5d5
commit
05648b0604
|
@ -616,12 +616,14 @@ sc_pkcs15emu_oberthur_add_pubkey(struct sc_pkcs15_card *p15card,
|
|||
offs += 2 + len;
|
||||
|
||||
/* ID */
|
||||
if (offs > info_len) {
|
||||
if (offs + 2 > info_len) {
|
||||
free(info_blob);
|
||||
LOG_TEST_RET(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Failed to add public key: no 'ID'");
|
||||
}
|
||||
len = *(info_blob + offs + 1) + *(info_blob + offs) * 0x100;
|
||||
if (!len || len > sizeof(key_info.id.value)) {
|
||||
if (len == 0
|
||||
|| len > sizeof(key_info.id.value)
|
||||
|| offs + 2 + len > info_len) {
|
||||
free(info_blob);
|
||||
LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, "Failed to add public key: invalid 'ID' length");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue