Skip to content

Commit 4b4f7af

Browse files
fennerfxlb
authored andcommitted
Update LS-Ack printing to not run off the end of the packet
1 parent b2d12da commit 4b4f7af

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

print-ospf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,8 @@ ospf_decode_v2(netdissect_options *ndo,
10671067

10681068
case OSPF_TYPE_LS_ACK:
10691069
lshp = op->ospf_lsa.lsa_lshdr;
1070-
while (ospf_print_lshdr(ndo, lshp) != -1) {
1070+
while ((const u_char *)lshp < dataend) {
1071+
ospf_print_lshdr(ndo, lshp);
10711072
++lshp;
10721073
}
10731074
break;

tests/TESTLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ mpls-over-udp-v mpls-over-udp.pcap mpls-over-udp-v.out -v
131131
# OSPF tests
132132
ospf-gmpls ospf-gmpls.pcap ospf-gmpls.out -v
133133
ospf-nssa-bitnt ospf-nssa-bitnt.pcap ospf-nssa-bitnt.out -v
134+
ospf-ack ospf-ack.pcap ospf-ack.out -v
134135
ospf3_ah-vv OSPFv3_with_AH.pcap ospf3_ah-vv.out -v -v
135136
ospf3_auth-vv ospf3_auth.pcapng ospf3_auth-vv.out -v -v
136137
ospf3_bc-vv OSPFv3_broadcast_adjacency.pcap ospf3_bc-vv.out -v -v

tests/ospf-ack.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
1 21:01:51.417510 IP (tos 0xc0, ttl 1, id 7082, offset 0, flags [DF], proto OSPF (89), length 84)
2+
1.0.1.2 > 224.0.0.5: OSPFv2, LS-Ack, length 64
3+
Router-ID 2.2.2.2, Area 0.0.0.1, Authentication Type: none (0)
4+
Advertising Router 1.1.1.1, seq 0x80000002, age 46s, length 16
5+
Router LSA (1), LSA-ID: 1.1.1.1
6+
Options: [External, Demand Circuit]
7+
Advertising Router 1.1.1.1, seq 0x80000001, age 43s, length 8
8+
Summary LSA (3), LSA-ID: 1.0.0.0
9+
Options: [External, Demand Circuit]

tests/ospf-ack.pcap

138 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)