Fix bad length in dgram.
authorJeremy Allison <jra@samba.org>
Tue, 24 Apr 2001 23:51:57 +0000 (23:51 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 24 Apr 2001 23:51:57 +0000 (23:51 +0000)
Jeremy.
(This used to be commit 8bd27845f0d8b19409ba79c028ce54732d7276e1)

source3/nmbd/nmbd_packets.c

index 142268b0b01bfa93c0d313bc3852ce42f5817a19..3fa382b96fe77190784bd32ff2b2edb3564ef100 100644 (file)
@@ -1273,6 +1273,13 @@ an error packet of type %x\n",
   if (len <= 0)
     return;
 
+  if (buf2 + len > buf + sizeof(dgram->data)) {
+    DEBUG(2,("process_dgram: datagram from %s to %s IP %s for %s of type %d len=%d too long.\n",
+               nmb_namestr(&dgram->source_name),nmb_namestr(&dgram->dest_name),
+               inet_ntoa(p->ip), smb_buf(buf),CVAL(buf2,0),len));
+       len = (buf + sizeof(dgram->data)) - buf;
+  }
+
   /* Datagram packet received for the browser mailslot */
   if (strequal(smb_buf(buf),BROWSE_MAILSLOT))
   {