From 58a4ab67fc75b62968634cddec290c1f2e2c1ded Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Thu, 4 Nov 2021 22:56:37 +0100 Subject: EAP: Fix some undefined behaviors at runtime 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print-eap.c b/print-eap.c index b0542ad9..5d722ec7 100644 --- a/print-eap.c +++ b/print-eap.c @@ -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); } -- cgit v1.2.1