From 75d9de99aec2d9f3bdc495c91bbd6d7a2392e2a3 Mon Sep 17 00:00:00 2001 From: Joseph Mingrone Date: Thu, 5 Sep 2024 23:11:27 -0300 Subject: Import tcpdump 4.99.5 Sponsored by: The FreeBSD Foundation --- print-ospf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'print-ospf.c') diff --git a/print-ospf.c b/print-ospf.c index e6bebed374f8..eae546d9c296 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -23,9 +23,7 @@ /* \summary: Open Shortest Path First (OSPF) printer */ -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" @@ -844,6 +842,11 @@ ospf_print_lsa(netdissect_options *ndo, break; } + + /* in OSPF everything has to be 32-bit aligned, including TLVs */ + if (tlv_length % 4) { + tlv_length += (4 - (tlv_length % 4)); + } tptr+=tlv_length; ls_length_remaining-=tlv_length; } @@ -1067,7 +1070,8 @@ ospf_decode_v2(netdissect_options *ndo, case OSPF_TYPE_LS_ACK: lshp = op->ospf_lsa.lsa_lshdr; - while (ospf_print_lshdr(ndo, lshp) != -1) { + while ((const u_char *)lshp < dataend) { + ospf_print_lshdr(ndo, lshp); ++lshp; } break; -- cgit v1.2.3