From: James Jones Date: Tue, 14 Nov 2023 19:58:02 +0000 (-0600) Subject: Avoid fr_nbo_to_uint16() to get EAP packet length (CID #1243443) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19177630ab5efb8032c659c1cf5c3be7eced9895;p=thirdparty%2Ffreeradius-server.git Avoid fr_nbo_to_uint16() to get EAP packet length (CID #1243443) Moved to talloc_array_length() instead, which worked much better after I looked at the source and saw it's a macro that uses the type of the argument, so it requires casting to pointer to the type it was allocated with. --- diff --git a/src/lib/eap/session.c b/src/lib/eap/session.c index 77c946f8a6e..33171cfc785 100644 --- a/src/lib/eap/session.c +++ b/src/lib/eap/session.c @@ -235,7 +235,7 @@ static char *eap_identity(request_t *request, eap_session_t *eap_session, eap_pa (eap_packet->code != FR_EAP_CODE_RESPONSE) || (eap_packet->data[0] != FR_EAP_METHOD_IDENTITY)) return NULL; - len = fr_nbo_to_uint16(eap_packet->length); + len = talloc_array_length((uint8_t *) eap_packet); /* * Note: The minimum length here is 5.