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'
(cherry picked from commit 58a4ab67fc75b62968634cddec290c1f2e2c1ded)
diff --git a/print-eap.c b/print-eap.c
index b0542ad..5d722ec 100644
--- a/print-eap.c
+++ b/print-eap.c
@@ -176,14 +176,14 @@
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);
}