From 0ad717cf20fa2ac4c1c293ff6662707704da10f7 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 45a4d2eea3..81a83dcc28 100644 --- a/lib/constate.c +++ b/lib/constate.c @@ -601,9 +601,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