]> The Tcpdump Group git mirrors - tcpdump/commitdiff
EAP: Fixup the check for Code value.
authorDenis Ovsienko <[email protected]>
Sat, 18 Aug 2018 18:00:36 +0000 (19:00 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 18 Aug 2018 18:00:36 +0000 (19:00 +0100)
Code value 0 is not assigned, and the code block guarded by the if() is
specific to Request (1) and Response (2) only. This change prevents the
printer from decoding some invalid EAP messages as if they were valid.

[skip ci]

print-eap.c

index ed2fb496d3eb2df5d81f18d6a31c647ecc8f753b..0dcf7e0bfcb3f860d00a73c085b95d5e81c4ad53 100644 (file)
@@ -189,7 +189,8 @@ eap_print(netdissect_options *ndo,
 
         ND_TCHECK_LEN(tptr, len);
 
-        if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
+        if (type == EAP_REQUEST || type == EAP_RESPONSE) {
+            /* RFC 3748 Section 4.1 */
             ND_TCHECK_1(tptr + 4);
             subtype = EXTRACT_U_1(tptr + 4);
             ND_PRINT("\n\t\t Type %s (%u)",