]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fail on invalid packet codes, instead of dereferencing NULL ptr
authorAlan T. DeKok <aland@freeradius.org>
Mon, 16 Feb 2026 17:20:55 +0000 (12:20 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 Feb 2026 00:25:49 +0000 (19:25 -0500)
this won't happen as the rest of the code is sane, but it's good
to double-check the values to be sure.

src/process/tls/base.c

index a79e5125c1604998cf2471dad2e3a4786dac6e8b..0760e3351faf53be59676ac9b599af14ff7fd601 100644 (file)
@@ -187,6 +187,14 @@ static unlang_action_t mod_process(unlang_result_t *p_result, module_ctx_t const
        request->module = NULL;
        fr_assert(request->proto_dict == dict_tls);
 
+       /*
+        *      Success, failure, and notfound are not TLS packets that we 
+        */
+       if (!request->packet->code || (request->packet->code > FR_PACKET_TYPE_VALUE_ESTABLISH_SESSION)) {
+               REDEBUG("Invalid packet code %u", request->packet->code);
+               RETURN_UNLANG_FAIL;
+       }
+
        UPDATE_STATE(packet);
 
        log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);