Skip to content

Commit 11d2f48

Browse files
committed
Guard ProcessKeyShare against truncated key shares
Add bounds check before reading named_group so malformed TLS 1.3 key share data cannot read past the supplied buffer.
1 parent 8b4f816 commit 11d2f48

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/sniffer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,6 +3285,9 @@ static int ProcessKeyShare(KeyShareInfo* info, const byte* input, int len,
32853285
XMEMSET(info, 0, sizeof(KeyShareInfo));
32863286

32873287
/* Named group and public key */
3288+
if (idx + OPAQUE16_LEN > len) {
3289+
return WOLFSSL_FATAL_ERROR;
3290+
}
32883291
info->named_group = (word16)((input[idx] << 8) | input[idx+1]);
32893292
idx += OPAQUE16_LEN;
32903293
info->key_len = 0;

0 commit comments

Comments
 (0)