]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IEEE 802.15.4: Add some bounds checks
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 11 May 2021 10:21:28 +0000 (12:21 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 12 May 2021 06:54:58 +0000 (08:54 +0200)
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.

print-802_15_4.c

index d3371641c21974377db3652d50c3ced371ad8ea3..3d307ffd02ac9b2aae020a0997642ada0c3118d1 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "addrtoname.h"
 
@@ -2138,6 +2139,7 @@ ieee802_15_4_std_frames(netdissect_options *ndo,
                                if (len < 0) {
                                        break;
                                }
+                               ND_TCHECK_LEN(p, len);
                                p += len;
                                caplen -= len;
                        }
@@ -2331,6 +2333,7 @@ ieee802_15_4_mp_frame(netdissect_options *ndo,
                if (len < 0) {
                        return 0;
                }
+               ND_TCHECK_LEN(p, len);
                p += len;
                caplen -= len;
        } else {