summaryrefslogtreecommitdiff
path: root/print-eap.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2021-11-04 22:56:37 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2021-11-04 22:58:40 +0100
commit58a4ab67fc75b62968634cddec290c1f2e2c1ded (patch)
tree1262b1af769d4b9b546a459a62bf618085731d4e /print-eap.c
parent30df635e5dd51bd126bfa6e8af2886a5054f7378 (diff)
downloadtcpdump-58a4ab67fc75b62968634cddec290c1f2e2c1ded.tar.gz
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'
Diffstat (limited to 'print-eap.c')
-rw-r--r--print-eap.c4
1 files 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);
}