From 7b6881b0626421daee1256e5e86938b57e418832 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 15 Sep 2017 09:53:01 +0200 Subject: _gnutls_epoch_gc: ensure there are no stray epochs after gc Signed-off-by: Nikos Mavrogiannopoulos --- lib/constate.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/constate.c b/lib/constate.c index 8a63fe1d32..e34038ad8f 100644 --- a/lib/constate.c +++ b/lib/constate.c @@ -602,9 +602,13 @@ void _gnutls_epoch_gc(gnutls_session_t session) min_index = i; /* Pick up the slack in the epoch window. */ - for (i = 0, j = min_index; j < MAX_EPOCH_INDEX; i++, j++) - session->record_parameters[i] = - session->record_parameters[j]; + if (min_index != 0) { + for (i = 0, j = min_index; j < MAX_EPOCH_INDEX; i++, j++) { + session->record_parameters[i] = + session->record_parameters[j]; + session->record_parameters[j] = NULL; + } + } /* Set the new epoch_min */ if (session->record_parameters[0] != NULL) -- cgit v1.2.1