summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-01-18 17:32:36 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-01-18 19:30:38 +0100
commit521ac1db3f6ba4654aa94227d9c146ab55c7d84f (patch)
treed84a7a088bf483d2e06fe1a56214ca584fa6e4a5 /tests
parent840c934e3e2dd1793e469d426abf6bf4afd0069b (diff)
downloadtcpdump-521ac1db3f6ba4654aa94227d9c146ab55c7d84f.tar.gz
LDP: Add some missing bounds checks
Replace calls to ipaddr_string()/ip6addr_string() with calls to GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds checking. Fix a regression in 78a4ee82226a3fe19981841dfe24d5e9cb437524. This fixes a buffer over-read in ldp_tlv_print() discovered by Jason Xiaole. Add a test using the capture file supplied by the reporter updated to keep only the packet showing the buffer over-read.
Diffstat (limited to 'tests')
-rw-r--r--tests/TESTLIST3
-rw-r--r--tests/ldp_tlv_print-oobr.out7
-rw-r--r--tests/ldp_tlv_print-oobr.pcapbin0 -> 116 bytes
3 files changed, 10 insertions, 0 deletions
diff --git a/tests/TESTLIST b/tests/TESTLIST
index 54f3f7a3..a61fdfcf 100644
--- a/tests/TESTLIST
+++ b/tests/TESTLIST
@@ -753,3 +753,6 @@ smb_data_print-oobr smb_data_print-oobr.pcapng smb_data_print-oobr.out -vv
smb_data_print-segv smb_data_print-segv.pcapng smb_data_print-segv.out -vv
#ptp tests
ptp ptp.pcap ptp.out
+
+# bad packets from Jason Xiaole
+ldp_tlv_print-oobr ldp_tlv_print-oobr.pcap ldp_tlv_print-oobr.out -v
diff --git a/tests/ldp_tlv_print-oobr.out b/tests/ldp_tlv_print-oobr.out
new file mode 100644
index 00000000..1ec4d342
--- /dev/null
+++ b/tests/ldp_tlv_print-oobr.out
@@ -0,0 +1,7 @@
+ 1 05:27:12.1010580 IP (tos 0x30, ttl 48, id 12336, offset 0, flags [none], proto UDP (17), length 12336, bad cksum 3030 (->699d)!)
+ 48.48.48.48.12336 > 48.48.48.48.646:
+ LDP, Label-Space-ID: 48.48.48.48:12336, pdu-length: 12336
+ Hello Message (0x0100), length: 20, Message ID: 0x30303030, Flags: [ignore if unknown]
+ Unknown TLV (0x3030), length: 4, Flags: [ignore and don't forward if unknown]
+ 0x0000: 3030 3030
+ IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown] [|ldp]
diff --git a/tests/ldp_tlv_print-oobr.pcap b/tests/ldp_tlv_print-oobr.pcap
new file mode 100644
index 00000000..9ec507c0
--- /dev/null
+++ b/tests/ldp_tlv_print-oobr.pcap
Binary files differ