add null sanity check to wolfSSL_SESSION_get_max_early_data, CID 516264

This commit is contained in:
JacobBarthelmeh
2025-04-18 16:31:33 -06:00
parent 73c286ae46
commit f834b9b08a
2 changed files with 7 additions and 0 deletions

View File

@ -3534,6 +3534,10 @@ int wolfSSL_SESSION_get_master_key_length(const WOLFSSL_SESSION* ses)
#ifdef WOLFSSL_EARLY_DATA #ifdef WOLFSSL_EARLY_DATA
unsigned int wolfSSL_SESSION_get_max_early_data(const WOLFSSL_SESSION *session) unsigned int wolfSSL_SESSION_get_max_early_data(const WOLFSSL_SESSION *session)
{ {
if (session == NULL) {
return BAD_FUNC_ARG;
}
return session->maxEarlyDataSz; return session->maxEarlyDataSz;
} }
#endif /* WOLFSSL_EARLY_DATA */ #endif /* WOLFSSL_EARLY_DATA */

View File

@ -1675,6 +1675,9 @@ static int test_quic_early_data(int verbose) {
QuicTestContext_free(&tclient); QuicTestContext_free(&tclient);
QuicTestContext_free(&tserver); QuicTestContext_free(&tserver);
/* check for error value with null argument */
ExpectIntEQ(wolfSSL_SESSION_get_max_early_data(NULL), BAD_FUNC_ARG);
/* QUIC requires 0 or 0xffffffff as only allowed values. /* QUIC requires 0 or 0xffffffff as only allowed values.
* Since we enabled early data in the server that created the session, * Since we enabled early data in the server that created the session,
* we need to see it here. */ * we need to see it here. */