Skip to content
Permalink
Browse files Browse the repository at this point in the history
oberthur: One more overlooked buffer overflow
  • Loading branch information
Jakuje committed Mar 21, 2021
1 parent 715c17c commit 5d4daf6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libopensc/pkcs15-oberthur.c
Expand Up @@ -609,7 +609,10 @@ sc_pkcs15emu_oberthur_add_pubkey(struct sc_pkcs15_card *p15card,
LOG_TEST_RET(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Failed to add public key: no 'Label'");
}
len = *(info_blob + offs + 1) + *(info_blob + offs) * 0x100;
if (len) {
if (offs + 2 + len > info_len) {
free(info_blob);
LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, "Failed to add public key: invalid 'Label' length");
} else if (len) {
if (len > sizeof(key_obj.label) - 1)
len = sizeof(key_obj.label) - 1;
memcpy(key_obj.label, info_blob + offs + 2, len);
Expand Down

0 comments on commit 5d4daf6

Please sign in to comment.