Skip to content

Commit

Permalink
Check key length before parsing it in FIDO2 attestation registration
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Nov 15, 2023
1 parent caa02e7 commit f9d8c06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scheme/webauthn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2299,13 +2299,13 @@ static json_t * register_new_attestation(struct config_module * config, json_t *
for (i=0; i<cbor_map_size(cbor_cose); i++) {
cbor_key = cbor_map_handle(cbor_cose)[i].key;
cbor_value = cbor_map_handle(cbor_cose)[i].value;
if (cbor_isa_negint(cbor_key) && cbor_get_int(cbor_key) == 1 && cbor_isa_bytestring(cbor_value)) {
if (cbor_isa_negint(cbor_key) && cbor_get_int(cbor_key) == 1 && cbor_isa_bytestring(cbor_value) && cbor_bytestring_length(cbor_value) <= 256) {
has_x = 1;
memcpy(cert_x, cbor_bytestring_handle(cbor_value), cbor_bytestring_length(cbor_value));
cert_x_len = cbor_bytestring_length(cbor_value);
g_x.data = cert_x;
g_x.size = (unsigned int)cbor_bytestring_length(cbor_value);
} else if (cbor_isa_negint(cbor_key) && cbor_get_int(cbor_key) == 2 && cbor_isa_bytestring(cbor_value)) {
} else if (cbor_isa_negint(cbor_key) && cbor_get_int(cbor_key) == 2 && cbor_isa_bytestring(cbor_value) && cbor_bytestring_length(cbor_value) <= 256) {
has_y = 1;
memcpy(cert_y, cbor_bytestring_handle(cbor_value), cbor_bytestring_length(cbor_value));
cert_y_len = cbor_bytestring_length(cbor_value);
Expand Down

0 comments on commit f9d8c06

Please sign in to comment.