X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/c3287e58b07b4e567e057f93c6beca9930cca064..8f94d68a09e1103353cc7d1133d6dfdf7d5a920d:/smbutil.c diff --git a/smbutil.c b/smbutil.c index 8d2d4170..e80b6636 100644 --- a/smbutil.c +++ b/smbutil.c @@ -12,23 +12,14 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.21 2002-04-26 05:12:40 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.25 2002-09-05 00:00:25 guy Exp $"; #endif -#include -#include -#include -#include +#include -#include - -#include #include #include #include -#ifdef TIME_WITH_SYS_TIME -#include -#endif #include "interface.h" #include "extract.h" @@ -261,10 +252,10 @@ print_asc(const unsigned char *buf, int len) safeputchar(buf[i]); } -static char * +static const char * name_type_str(int name_type) { - char *f = NULL; + const char *f = NULL; switch (name_type) { case 0: f = "Workstation"; break; @@ -322,9 +313,9 @@ print_data(const unsigned char *buf, int len) static void -write_bits(unsigned int val, char *fmt) +write_bits(unsigned int val, const char *fmt) { - char *p = fmt; + const char *p = fmt; int i = 0; while ((p = strchr(fmt, '|'))) { @@ -365,7 +356,7 @@ unistr(const u_char *s, int *len) *len = 1; } - while (l < (sizeof(buf) - 1) && s[0] && s[1] == 0) { + while (l < (int)(sizeof(buf) - 1) && s[0] && s[1] == 0) { buf[l] = s[0]; s += 2; l++; @@ -380,7 +371,7 @@ static const u_char * smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf) { int reverse = 0; - char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|"; + const char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|"; int len; while (*fmt && buf sizeof(s)) { + if ((size_t)(p - fmt + 1) > sizeof(s)) { /* overrun */ return(buf); } @@ -801,7 +802,7 @@ err_code_struct hard_msgs[] = { static struct { int code; - char *class; + const char *class; err_code_struct *err_msgs; } err_classes[] = { { 0, "SUCCESS", NULL },