From 9ad20ce0b9ce760ad86a9a954c9662d8e4a346fe Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 19 Sep 2017 10:02:25 +0100 Subject: [PATCH] pathmtu/pathmtu.c (raw): Check the UDP packet signature. --- pathmtu/pathmtu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pathmtu/pathmtu.c b/pathmtu/pathmtu.c index 6d988031..f42602e0 100644 --- a/pathmtu/pathmtu.c +++ b/pathmtu/pathmtu.c @@ -533,6 +533,7 @@ static int raw_selproc(void *stv, fd_set *fd_in, struct probestate *ps) struct ip *ip; struct icmp *icmp; struct udphdr *udp; + const unsigned char *payload; ssize_t n; /* An ICMP packet: see what's inside. */ @@ -565,6 +566,9 @@ static int raw_selproc(void *stv, fd_set *fd_in, struct probestate *ps) goto skip_icmp; n -= sizeof(*udp); + payload = (const unsigned char *)(udp + 1); + if (!mypacketp(ps, payload, n)) goto skip_icmp; + if (icmp->icmp_code == ICMP_UNREACH_PORT) return (RC_HIGHER); else if (icmp->icmp_code != ICMP_UNREACH_NEEDFRAG) goto skip_icmp; else if (icmp->icmp_nextmtu) return (htons(icmp->icmp_nextmtu)); -- 2.11.0