]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Avoid fr_nbo_to_uint16() to get EAP packet length (CID #1243443)
authorJames Jones <jejones3141@gmail.com>
Tue, 14 Nov 2023 19:58:02 +0000 (13:58 -0600)
committerAlan DeKok <aland@freeradius.org>
Tue, 14 Nov 2023 20:53:28 +0000 (15:53 -0500)
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.

src/lib/eap/session.c

index 77c946f8a6e4f9baf46cb7a1c20522e51ec6b1b5..33171cfc785a4b7ed5c625b97c5fb664912afa0d 100644 (file)
@@ -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.