Skip to content

Commit e0800c8

Browse files
Code review feedback
1 parent bcea3ea commit e0800c8

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;
@@ -13217,7 +13217,9 @@ int wc_PKCS7_DecodeEnvelopedData(wc_PKCS7* pkcs7, byte* in,
1321713217
}
1321813218
wc_PKCS7_DecryptContentFree(pkcs7, encOID, pkcs7->heap);
1321913219
} else {
13220-
if ((idx + (word32)encryptedContentTotalSz) > pkiMsgSz) {
13220+
word32 tmpSum;
13221+
if (!WC_SAFE_SUM_WORD32(idx, (word32)encryptedContentTotalSz, tmpSum) ||
13222+
tmpSum > pkiMsgSz) {
1322113223
ret = BUFFER_E;
1322213224
break;
1322313225
}

0 commit comments

Comments
 (0)