Skip to content

Commit f834b9b

Browse files
add null sanity check to wolfSSL_SESSION_get_max_early_data, CID 516264
1 parent 73c286a commit f834b9b

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/ssl_sess.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,6 +3534,10 @@ int wolfSSL_SESSION_get_master_key_length(const WOLFSSL_SESSION* ses)
35343534
#ifdef WOLFSSL_EARLY_DATA
35353535
unsigned int wolfSSL_SESSION_get_max_early_data(const WOLFSSL_SESSION *session)
35363536
{
3537+
if (session == NULL) {
3538+
return BAD_FUNC_ARG;
3539+
}
3540+
35373541
return session->maxEarlyDataSz;
35383542
}
35393543
#endif /* WOLFSSL_EARLY_DATA */

tests/quic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,9 @@ static int test_quic_early_data(int verbose) {
16751675
QuicTestContext_free(&tclient);
16761676
QuicTestContext_free(&tserver);
16771677

1678+
/* check for error value with null argument */
1679+
ExpectIntEQ(wolfSSL_SESSION_get_max_early_data(NULL), BAD_FUNC_ARG);
1680+
16781681
/* QUIC requires 0 or 0xffffffff as only allowed values.
16791682
* Since we enabled early data in the server that created the session,
16801683
* we need to see it here. */

0 commit comments

Comments
 (0)