ctdb-common: Fix the TCP packet length check
authorAmitay Isaacs <amitay@gmail.com>
Thu, 26 Jul 2018 04:51:44 +0000 (14:51 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 28 Jul 2018 01:50:11 +0000 (03:50 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/common/system_socket.c

index 562b2bf1aafff73d8914d5f86b675114fb4d9e69..22776f73ea557ab0852a50601e8532d081fa55b8 100644 (file)
@@ -775,7 +775,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) > ret) {
+                   (ip->ip_hl*4) > pkthdr.len) {
                        return -1;
                }
                /* TCP */