Skip to content

Commit

Permalink
wolfcrypt/src/pkcs7.c: in wc_PKCS7_BuildSignedAttributes(), clear can…
Browse files Browse the repository at this point in the history
…nedAttribs[idx] before it's conditionally populated, to prevent possible uninited data read in subsequent EncodeAttributes().
  • Loading branch information
douzzer committed Jan 7, 2025
1 parent 8c32238 commit b6ce89c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wolfcrypt/src/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,8 @@ static int wc_PKCS7_BuildSignedAttributes(wc_PKCS7* pkcs7, ESD* esd,

cannedAttribsCount = sizeof(cannedAttribs)/sizeof(PKCS7Attrib);

XMEMSET(&cannedAttribs[idx], 0, sizeof(cannedAttribs[idx]));

if ((pkcs7->defaultSignedAttribs & WOLFSSL_CONTENT_TYPE_ATTRIBUTE) ||
pkcs7->defaultSignedAttribs == 0) {
cannedAttribs[idx].oid = contentTypeOid;
Expand Down

0 comments on commit b6ce89c

Please sign in to comment.