sec-mod, worker: harden TLS resumption cache against empty session data

A cached resume entry can end up with zero-length session_data, which is
not valid resumption data.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos
2026-07-28 08:07:07 +02:00
parent 9e71c1b8b6
commit 77e06aec8a
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -126,7 +126,8 @@ int handle_resume_store_req(sec_mod_st *sec,
if (req->session_id.len > GNUTLS_MAX_SESSION_ID)
return -1;
if (req->session_data.len > MAX_SESSION_DATA_SIZE)
if (req->session_data.len == 0 ||
req->session_data.len > MAX_SESSION_DATA_SIZE)
return -1;
max = MAX(2 * GETRCONFIG(sec)->max_clients,
+2 -1
View File
@@ -54,7 +54,8 @@ static int recv_resume_fetch_reply(worker_st *ws, int sd, gnutls_datum_t *sdata)
return ret;
}
if (resp->reply != SESSION_RESUME_REPLY_MSG__RESUME__REP__OK) {
if (resp->reply != SESSION_RESUME_REPLY_MSG__RESUME__REP__OK ||
resp->session_data.len == 0) {
ret = -1;
goto cleanup;
}