From 60d00043e43d01b41aa21b6d7e905469eccab9c1 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 17 May 2017 11:39:07 -0400 Subject: [PATCH] check before dereference. Found by PVS-Studio --- src/modules/rlm_eap/libeap/eap_tls.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/modules/rlm_eap/libeap/eap_tls.c b/src/modules/rlm_eap/libeap/eap_tls.c index fadc72c..a08cd50 100644 --- a/src/modules/rlm_eap/libeap/eap_tls.c +++ b/src/modules/rlm_eap/libeap/eap_tls.c @@ -325,13 +325,15 @@ static fr_tls_status_t eaptls_verify(eap_handler_t *handler) if (prev_eap_ds && prev_eap_ds->response) eaptls_prev = (eaptls_packet_t *)prev_eap_ds->response->type.data; - /* - * First output the flags (for debugging) - */ - RDEBUG3("Peer sent flags %c%c%c", - TLS_START(eaptls_packet->flags) ? 'S' : '-', - TLS_MORE_FRAGMENTS(eaptls_packet->flags) ? 'M' : '-', - TLS_LENGTH_INCLUDED(eaptls_packet->flags) ? 'L' : '-'); + if (eaptls_packet) { + /* + * First output the flags (for debugging) + */ + RDEBUG3("Peer sent flags %c%c%c", + TLS_START(eaptls_packet->flags) ? 'S' : '-', + TLS_MORE_FRAGMENTS(eaptls_packet->flags) ? 'M' : '-', + TLS_LENGTH_INCLUDED(eaptls_packet->flags) ? 'L' : '-'); + } /* * check for ACK -- 2.1.4