Skip to content

Commit

Permalink
fuzz: exercise fido_cred_x5c_list_{count,len,ptr}()
Browse files Browse the repository at this point in the history
  • Loading branch information
LDVG committed Feb 27, 2024
1 parent 4dc15e0 commit ca809da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fuzz/export.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
fido_cred_verify;
fido_cred_verify_self;
fido_cred_x5c_len;
fido_cred_x5c_list_count;
fido_cred_x5c_list_len;
fido_cred_x5c_list_ptr;
fido_cred_x5c_ptr;
fido_dev_build;
fido_dev_cancel;
Expand Down
5 changes: 5 additions & 0 deletions fuzz/fuzz_cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ verify_cred(int type, const unsigned char *cdh_ptr, size_t cdh_len,
if (fmt)
fido_cred_set_fmt(cred, fmt);

/* XXX +1 on purpose */
for (size_t i = 0; i < fido_cred_x5c_list_count(cred) + 1; i++)
consume(fido_cred_x5c_list_ptr(cred, i),
fido_cred_x5c_list_len(cred, i));

/* repeat memory operations to trigger reallocation paths */
if (fido_cred_set_authdata(cred, authdata_ptr, authdata_len) != FIDO_OK)
fido_cred_set_authdata_raw(cred, authdata_raw_ptr,
Expand Down

0 comments on commit ca809da

Please sign in to comment.