Skip to content

Commit 94955b1

Browse files
Code review feedback
1 parent c99bc5d commit 94955b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wolfcrypt/src/pkcs7.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,7 @@ static int wc_PKCS7_BuildSignedAttributes(wc_PKCS7* pkcs7, ESD* esd,
22552255
esd->signedAttribsCount += idx;
22562256
esd->signedAttribsSz += (word32)EncodeAttributes(
22572257
&esd->signedAttribs[atrIdx], (int)idx, cannedAttribs,
2258-
(int)cannedAttribsCount);
2258+
(int)idx);
22592259
atrIdx += idx;
22602260
} else {
22612261
esd->signedAttribsCount = 0;
@@ -13223,7 +13223,9 @@ int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* in,
1322313223
}
1322413224
wc_PKCS7_DecryptContentFree(pkcs7, encOID, pkcs7->heap);
1322513225
} else {
13226-
if ((idx + (word32)encryptedContentTotalSz) > pkiMsgSz) {
13226+
word32 tmpSum;
13227+
if (!WC_SAFE_SUM_WORD32(idx, (word32)encryptedContentTotalSz, tmpSum) ||
13228+
tmpSum > pkiMsgSz) {
1322713229
ret = BUFFER_E;
1322813230
break;
1322913231
}

0 commit comments

Comments
 (0)