From: Denis Ovsienko Date: Sat, 18 Aug 2018 18:00:36 +0000 (+0100) Subject: EAP: Fixup the check for Code value. X-Git-Tag: tcpdump-4.99-bp~1050 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/6bda3d15156ec0cf40f82fc2e868c68c1cb05ff7 EAP: Fixup the check for Code value. 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] --- diff --git a/print-eap.c b/print-eap.c index ed2fb496..0dcf7e0b 100644 --- a/print-eap.c +++ b/print-eap.c @@ -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)",