]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
provide multiline output for PIM Joins/Grafts/Graft-Acks
[tcpdump] / smbutil.c
index e80b663628a5ecc8731f14c5cd1a20ee9a812ade..d2a08f2bb29e0258bb0afdf02230e3bbe43bb3ea 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -11,8 +11,8 @@
 #endif
 
 #ifndef lint
-static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.25 2002-09-05 00:00:25 guy Exp $";
+static const char rcsid[] _U_ =
+     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.28 2003-11-16 09:36:43 guy Exp $";
 #endif
 
 #include <tcpdump-stdinc.h>
@@ -396,8 +396,12 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
 
            p = strchr(++fmt, '}');
            l = PTR_DIFF(p, fmt);
+
+           if ((unsigned int)l > sizeof(bitfmt) - 1)
+                   l = sizeof(bitfmt)-1;
+
            strncpy(bitfmt, fmt, l);
-           bitfmt[l] = 0;
+           bitfmt[l] = '\0';
            fmt = p + 1;
            write_bits(buf[0], bitfmt);
            buf++;