From: guy Date: Sun, 16 Oct 2005 06:05:46 +0000 (+0000) Subject: From Noritoshi Demizu: memcmp() returns a value = 0 if the two memory X-Git-Tag: tcpdump-3.9.6~66 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/9f0bdf0635b2aa3c51bd090e5bdee72ccd4fc281 From Noritoshi Demizu: memcmp() returns a value = 0 if the two memory regions are =, < 0 if the first memory region is < the second, or > 0 if the first memory region is > the second, so to check whether two memory regions are equal, check whether memcmp()'s return value is == 0. --- diff --git a/print-tcp.c b/print-tcp.c index 7a1a592b..9b6c2a2f 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.120.2.2 2005-04-21 06:36:05 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.120.2.3 2005-10-16 06:05:46 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -799,7 +799,7 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp, MD5_Update(&ctx, tcpmd5secret, strlen(tcpmd5secret)); MD5_Final(sig, &ctx); - if (memcmp(rcvsig, sig, 16)) + if (memcmp(rcvsig, sig, TCP_SIGLEN) == 0) return (SIGNATURE_VALID); else return (SIGNATURE_INVALID);