Skip to content

Commit f59d50f

Browse files
committed
bound notBeforeDataEnd with origSz
1 parent 0c9b639 commit f59d50f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/api/test_x509.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ static int craft_malicious_time_cert(const byte* orig, int origSz,
502502

503503
notBeforeLenOff = validityOff + 3; /* the 0x0D byte */
504504
notBeforeDataEnd = notBeforeLenOff + 1 + 13; /* tag(1) was at +2, data starts at +4 */
505+
if (notBeforeDataEnd >= origSz) {
506+
return -1;
507+
}
505508

506509
/* Build the new buffer:
507510
* [0 .. notBeforeLenOff-1] unchanged prefix

0 commit comments

Comments
 (0)