Skip to content

Commit 2724edc

Browse files
author
Lealem Amedie
committed
Check buffer length before XMEMCMP in GetOID
1 parent c4b77ad commit 2724edc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

wolfcrypt/src/asn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5760,7 +5760,8 @@ static int GetOID(const byte* input, word32* inOutIdx, word32* oid,
57605760
*
57615761
* These hacks will hopefully disappear when new standardized OIDs appear.
57625762
*/
5763-
if (memcmp(&input[idx], sigSphincsFast_Level3Oid,
5763+
if (idx + (word32)sizeof(sigSphincsFast_Level3Oid) < (word32)length &&
5764+
XMEMCMP(&input[idx], sigSphincsFast_Level3Oid,
57645765
sizeof(sigSphincsFast_Level3Oid)) == 0) {
57655766
found_collision = SPHINCS_FAST_LEVEL3k;
57665767
}

0 commit comments

Comments
 (0)