]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
handle corrupt ctdb packets better
authorAndrew Tridgell <tridge@samba.org>
Sat, 26 May 2007 04:46:12 +0000 (14:46 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 26 May 2007 04:46:12 +0000 (14:46 +1000)
(This used to be ctdb commit aea4d78645a99eb22860048350b5f20841c17704)

ctdb/common/ctdb_io.c

index 256b021bed69b0da884b159598aa7a6a527246e5..92cb5bbf2a142446337073a6bc611eb1762f45f1 100644 (file)
@@ -109,6 +109,11 @@ static void queue_io_read(struct ctdb_queue *queue)
                uint8_t *d2;
                uint32_t len;
                len = *(uint32_t *)data;
+               if (len == 0) {
+                       /* bad packet! treat as EOF */
+                       DEBUG(0,("Invalid packet of length 0\n"));
+                       goto failed;
+               }
                d2 = talloc_memdup(queue, data, len);
                if (d2 == NULL) {
                        DEBUG(0,("read error memdup failed for %u\n", len));