check before dereference. Found by PVS-Studio
[freeradius.git] / src / modules / rlm_eap / libeap / eap_tls.c
index fadc72c..a08cd50 100644 (file)
@@ -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