X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/edb0e92cdcaf06168a38e632847b8fd2c0a62a2d..5c77a341d4e766eef8beebaecd9e69bd2cc7b59b:/smbutil.c diff --git a/smbutil.c b/smbutil.c index e80b6636..d2a08f2b 100644 --- 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 @@ -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++;