Skip to content

Commit 67deae1

Browse files
committed
frag6: Add a bounds check in non-verbose mode
Define ND_LONGJMP_FROM_TCHECK. Rename a test and its output, with "-v" in the names. Add a test case (same pcap printed without "-v").
1 parent 873b872 commit 67deae1

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

print-frag6.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "netdissect-stdinc.h"
2727

28+
#define ND_LONGJMP_FROM_TCHECK
2829
#include "netdissect.h"
2930
#include "extract.h"
3031

@@ -43,6 +44,8 @@ frag6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2)
4344
ND_PRINT("frag (");
4445
if (ndo->ndo_vflag)
4546
ND_PRINT("0x%08x:", GET_BE_U_4(dp->ip6f_ident));
47+
else
48+
ND_TCHECK_4(dp->ip6f_ident);
4649
ND_PRINT("%u|", GET_BE_U_2(dp->ip6f_offlg) & IP6F_OFF_MASK);
4750
if ((bp - bp2) + sizeof(struct ip6_frag) >
4851
sizeof(struct ip6_hdr) + GET_BE_U_2(ip6->ip6_plen))

tests/TESTLIST

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,8 @@ pim_header_asan pim_header_asan.pcap pim_header_asan.out -v
773773
pim_header_asan-2 pim_header_asan-2.pcap pim_header_asan-2.out -v
774774
pim_header_asan-3 pim_header_asan-3.pcap pim_header_asan-3.out -v
775775
pim_header_asan-4 pim_header_asan-4.pcap pim_header_asan-4.out -v
776-
ip6_frag_asan ip6_frag_asan.pcap ip6_frag_asan.out -v
776+
ip6_frag_asan ip6_frag_asan.pcap ip6_frag_asan.out
777+
ip6_frag_asan-v ip6_frag_asan.pcap ip6_frag_asan-v.out -v
777778
radius_attr_asan radius_attr_asan.pcap radius_attr_asan.out -v
778779
ospf6_decode_v3_asan ospf6_decode_v3_asan.pcap ospf6_decode_v3_asan.out -v
779780
ip_ts_opts_asan ip_ts_opts_asan.pcap ip_ts_opts_asan.out -v

tests/ip6_frag_asan-v.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 2038-01-01 00:00:00.000000 IP6 (class 0x51, flowlabel 0xb2100, hlim 16, next-header Fragment (44), payload length 27136) 452:22:19:0:41a:e4ff:10ff:484d > 2243:80:1400:100:19:ffff:ffff:fffb: frag ( [|frag6]

tests/ip6_frag_asan.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1 2038-01-01 00:00:00.000000 IP6 (class 0x51, flowlabel 0xb2100, hlim 16, next-header Fragment (44), payload length 27136) 452:22:19:0:41a:e4ff:10ff:484d > 2243:80:1400:100:19:ffff:ffff:fffb: frag ( [|frag6]
1+
1 2038-01-01 00:00:00.000000 IP6 452:22:19:0:41a:e4ff:10ff:484d > 2243:80:1400:100:19:ffff:ffff:fffb: frag ( [|frag6]

0 commit comments

Comments
 (0)