Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Apr 2024 08:45:03 +0000
From:      bugzilla-noreply@freebsd.org
To:        pf@FreeBSD.org
Subject:   [Bug 278034] tcpdump's ip6_print can read beyond buffer end
Message-ID:  <bug-278034-16861-cNX9n01NpM@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-278034-16861@https.bugs.freebsd.org/bugzilla/>
References:  <bug-278034-16861@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278034

--- Comment #3 from Kristof Provost <kp@freebsd.org> ---
To answer my own question, I think this may suffice:

diff --git a/contrib/tcpdump/print-pfsync.c b/contrib/tcpdump/print-pfsync.c
index 5710e36ded6c..e22c11a2df2d 100644
--- a/contrib/tcpdump/print-pfsync.c
+++ b/contrib/tcpdump/print-pfsync.c
@@ -86,7 +86,7 @@ pfsync_ip_print(netdissect_options *ndo , const u_char *b=
p,
u_int len)
 {
        struct pfsync_header *hdr =3D (struct pfsync_header *)bp;

-       if (len < PFSYNC_HDRLEN)
+       if (len < PFSYNC_HDRLEN || ! ND_TTEST_LEN(bp, len))
                ND_PRINT("[|pfsync]");
        else
                pfsync_print(ndo, hdr, bp + sizeof(struct pfsync_header),

At the very least it makes valgrind happy without actually appearing to bre=
ak
tcpdump's support for pfsync.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-278034-16861-cNX9n01NpM>