summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-13 09:12:19 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-13 09:12:19 +0200
commitcf0f4f92acc9695a7f02472c0f2868fdc46483a2 (patch)
tree7b67bfba3c013e06ddc1c25b7e5a71ec64768499
parent3b319a4aa15d779b82e6fe369a4c483b7db64a9a (diff)
downloadgnutls-cf0f4f92acc9695a7f02472c0f2868fdc46483a2.tar.gz
record: added sanity checking in the record layer version copy
Previously we assumed that an active session had always a version set, however there have been reports of evolution crashing in that particular point. Although, this could have been due to memory corruption, be careful and check for invalid input. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/record.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/record.c b/lib/record.c
index 14fc42d1b0..5a9f9139a5 100644
--- a/lib/record.c
+++ b/lib/record.c
@@ -362,10 +362,10 @@ copy_record_version(gnutls_session_t session,
{
const version_entry_st *lver;
- if (session->internals.initial_negotiation_completed
+ lver = get_version(session);
+ if (lver && (session->internals.initial_negotiation_completed
|| htype != GNUTLS_HANDSHAKE_CLIENT_HELLO
- || session->internals.default_record_version[0] == 0) {
- lver = get_version(session);
+ || session->internals.default_record_version[0] == 0)) {
version[0] = lver->major;
version[1] = lver->minor;