]> The Tcpdump Group git mirrors - tcpdump/commitdiff
EAP: no need for the count variable to be signed.
authorGuy Harris <[email protected]>
Sun, 14 Nov 2021 02:34:00 +0000 (18:34 -0800)
committerGuy Harris <[email protected]>
Sun, 14 Nov 2021 02:34:00 +0000 (18:34 -0800)
Make it unsigned, and, while we're at it, make the loop a for loop.

print-eap.c

index 1539b7a7a9036463c3db99819f206cf4491c050b..8a2411cbf25db8e36f8d63398b331e4d6c55d0d6 100644 (file)
@@ -152,7 +152,7 @@ eap_print(netdissect_options *ndo,
           u_int length)
 {
     u_int type, subtype, len;
           u_int length)
 {
     u_int type, subtype, len;
-    int count;
+    u_int count;
 
     type = GET_U_1(cp);
     len = GET_BE_U_2(cp + 2);
 
     type = GET_U_1(cp);
     len = GET_BE_U_2(cp + 2);
@@ -190,18 +190,15 @@ eap_print(netdissect_options *ndo,
                 break;
 
             case EAP_TYPE_NAK:
                 break;
 
             case EAP_TYPE_NAK:
-                count = 5;
-
                 /*
                  * one or more octets indicating
                  * the desired authentication
                  * type one octet per type
                  */
                 /*
                  * one or more octets indicating
                  * the desired authentication
                  * type one octet per type
                  */
-                while (count < (int)len) {
+                for (count = 5; count < len; count++) {
                     ND_PRINT(" %s (%u),",
                            tok2str(eap_type_values, "unknown", GET_U_1((cp + count))),
                            GET_U_1(cp + count));
                     ND_PRINT(" %s (%u),",
                            tok2str(eap_type_values, "unknown", GET_U_1((cp + count))),
                            GET_U_1(cp + count));
-                    count++;
                 }
                 break;
 
                 }
                 break;