Skip to content

Commit 7245ad0

Browse files
authored
Merge pull request #9748 from gasbytes/wolfSSL_d2i_SSL_SESSION-fix
add missing checks in wolfSSL_d2i_SSL_SESSION
2 parents bf86450 + f94eb68 commit 7245ad0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ssl_sess.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,12 +2827,20 @@ WOLFSSL_SESSION* wolfSSL_d2i_SSL_SESSION(WOLFSSL_SESSION** sess,
28272827
goto end;
28282828
}
28292829
s->chain.count = data[idx++];
2830+
if (s->chain.count > MAX_CHAIN_DEPTH) {
2831+
ret = BUFFER_ERROR;
2832+
goto end;
2833+
}
28302834
for (j = 0; j < s->chain.count; j++) {
28312835
if (i - idx < OPAQUE16_LEN) {
28322836
ret = BUFFER_ERROR;
28332837
goto end;
28342838
}
28352839
ato16(data + idx, &length); idx += OPAQUE16_LEN;
2840+
if (length > MAX_X509_SIZE) {
2841+
ret = BUFFER_ERROR;
2842+
goto end;
2843+
}
28362844
s->chain.certs[j].length = length;
28372845
if (i - idx < length) {
28382846
ret = BUFFER_ERROR;

0 commit comments

Comments
 (0)