From da1c42b4c0ecd653522d657a51eec4ef70210524 Mon Sep 17 00:00:00 2001 From: maxim Date: Mon, 14 Apr 2003 08:34:14 +0000 Subject: o Skip timestamp part when checking payload. PR: bin/50909 Submitted by: Barney Wolff --- sbin/ping/ping.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 1660760..a665048 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1012,8 +1012,14 @@ pr_pack(buf, cc, from, tv) cp = (u_char*)&icp->icmp_data[phdr_len]; dp = &outpack[MINICMPLEN + phdr_len]; cc -= ICMP_MINLEN + phdr_len; - for (i = phdr_len; i < datalen && cc != 0; - ++i, ++cp, ++dp, cc--) { + i = 0; + if (timing) { /* don't check variable timestamp */ + cp += TIMEVAL_LEN; + dp += TIMEVAL_LEN; + cc -= TIMEVAL_LEN; + i += TIMEVAL_LEN; + } + for (; i < datalen && cc > 0; ++i, ++cp, ++dp, --cc) { if (*cp != *dp) { (void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x", i, *dp, *cp); -- cgit v1.1