]> The Tcpdump Group git mirrors - tcpdump/commitdiff
EAP: Fix some undefined behaviors at runtime
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 4 Nov 2021 21:56:37 +0000 (22:56 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 4 Nov 2021 21:58:40 +0000 (22:58 +0100)
The errors were like:
print-eap.c:179:25: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
print-eap.c:181:50: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
print-eap.c:186:25: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'
print-eap.c:188:50: runtime error: unsigned integer overflow:
  2 - 5 cannot be represented in type 'unsigned int'

print-eap.c

index b0542ad94b59ac8c2ebc5665f268c141877ea464..5d722ec7a3eca0753e563dcf7471364415864a93 100644 (file)
@@ -176,14 +176,14 @@ eap_print(netdissect_options *ndo,
 
         switch (subtype) {
             case EAP_TYPE_IDENTITY:
-                if (len - 5 > 0) {
+                if (len > 5 ) {
                     ND_PRINT(", Identity: ");
                     nd_printjnp(ndo, cp + 5, len - 5);
                 }
                 break;
 
             case EAP_TYPE_NOTIFICATION:
-                if (len - 5 > 0) {
+                if (len > 5) {
                     ND_PRINT(", Notification: ");
                     nd_printjnp(ndo, cp + 5, len - 5);
                 }