Skip to content

Commit 72b26be

Browse files
committed
Fix GetObjectId bounds in PKCS12 ContentInfo parsing
Bound GetObjectId() by the ContentInfo SEQUENCE end (curIdx + curSz) instead of the full buffer size. This prevents the OID TLV from being parsed past the SEQUENCE boundary in the first place, complementing the post-check added in PR wolfSSL#10018. Previously, GetObjectId received (word32)size as maxIdx, allowing it to read OID data beyond the ContentInfo SEQUENCE. The post-check then caught this after the fact. With this change, GetObjectId itself rejects an OID that would exceed the SEQUENCE, so the over-read never occurs.
1 parent 1fab253 commit 72b26be

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

wolfcrypt/src/pkcs12.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
328328

329329
curIdx = localIdx;
330330
if ((ret = GetObjectId(input, &localIdx, &oid, oidIgnoreType,
331-
(word32)size)) < 0) {
331+
curIdx + (word32)curSz)) < 0) {
332332
WOLFSSL_LEAVE("Get object id failed", ret);
333333
freeSafe(safe, pkcs12->heap);
334334
return ret;

0 commit comments

Comments
 (0)