X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fd11c38033dc1c7387e71a711be141a74ea73bfa..8f94d68a09e1103353cc7d1133d6dfdf7d5a920d:/smbutil.c diff --git a/smbutil.c b/smbutil.c index 48e5116a..e80b6636 100644 --- a/smbutil.c +++ b/smbutil.c @@ -12,7 +12,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.24 2002-09-04 09:53:42 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.25 2002-09-05 00:00:25 guy Exp $"; #endif #include @@ -252,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; @@ -313,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, '|'))) { @@ -356,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++; @@ -371,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); } @@ -802,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 },