Skip to content

Commit 4276e7b

Browse files
committed
fail on invalid packet codes, instead of dereferencing NULL ptr
this won't happen as the rest of the code is sane, but it's good to double-check the values to be sure.
1 parent 52e1766 commit 4276e7b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/process/tls/base.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ static unlang_action_t mod_process(unlang_result_t *p_result, module_ctx_t const
187187
request->module = NULL;
188188
fr_assert(request->proto_dict == dict_tls);
189189

190+
/*
191+
* Success, failure, and notfound are not TLS packets that we
192+
*/
193+
if (!request->packet->code || (request->packet->code > FR_PACKET_TYPE_VALUE_ESTABLISH_SESSION)) {
194+
REDEBUG("Invalid packet code %u", request->packet->code);
195+
RETURN_UNLANG_FAIL;
196+
}
197+
190198
UPDATE_STATE(packet);
191199

192200
log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);

0 commit comments

Comments
 (0)