From: Martin Schwenke Date: Fri, 17 Aug 2018 05:36:41 +0000 (+1000) Subject: ctdb-common: Fix a bug in non-Linux (PCAP) TCP packet capturing X-Git-Tag: tdb-1.3.17~1965 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3a1f1e1fa9a8a0fe6ffd3809a64d8185cb561b7;p=thirdparty%2Fsamba.git ctdb-common: Fix a bug in non-Linux (PCAP) TCP packet capturing Captured packets include a link-layer header, which is considered in the Linux code but not the PCAP code. Also, the actual captured length is in caplen, not len. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c index 4617be48bd7..c72c61ad978 100644 --- a/ctdb/common/system_socket.c +++ b/ctdb/common/system_socket.c @@ -962,7 +962,7 @@ int ctdb_sys_read_tcp_packet(int s, /* make sure its not a short packet */ if (offsetof(struct tcphdr, th_ack) + 4 + - (ip->ip_hl*4) > pkthdr.len) { + (ip->ip_hl*4) + sizeof(*eth) > pkthdr.caplen) { return -1; } /* TCP */