From 11e454d0ba87183f359a63ee0119ae27f50496af Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 27 May 2020 02:18:38 -0700 Subject: ospf6: note some places where subtraction won't underflow. --- print-ospf6.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'print-ospf6.c') diff --git a/print-ospf6.c b/print-ospf6.c index c94a7793..5c0b090d 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -574,6 +574,11 @@ ospf6_print_lsa(netdissect_options *ndo, bytelen = ospf6_print_lsaprefix(ndo, tptr, lsa_length); if (bytelen < 0) goto trunc; + /* + * ospf6_print_lsaprefix() will return -1 if + * the length is too high, so this will not + * underflow. + */ lsa_length -= bytelen; tptr += bytelen; } @@ -596,6 +601,11 @@ ospf6_print_lsa(netdissect_options *ndo, bytelen = ospf6_print_lsaprefix(ndo, tptr, lsa_length); if (bytelen < 0) goto trunc; + /* + * ospf6_print_lsaprefix() will return -1 if + * the length is too high, so this will not + * underflow. + */ lsa_length -= bytelen; tptr += bytelen; @@ -657,6 +667,11 @@ ospf6_print_lsa(netdissect_options *ndo, if (bytelen < 0) goto trunc; prefixes--; + /* + * ospf6_print_lsaprefix() will return -1 if + * the length is too high, so this will not + * underflow. + */ lsa_length -= bytelen; tptr += bytelen; } @@ -685,6 +700,11 @@ ospf6_print_lsa(netdissect_options *ndo, if (bytelen < 0) goto trunc; prefixes--; + /* + * ospf6_print_lsaprefix() will return -1 if + * the length is too high, so this will not + * underflow. + */ lsa_length -= bytelen; tptr += bytelen; } -- cgit v1.2.1