]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
Make "-x" and "-X" work with PPPoE interfaces; based on code from Darren
[tcpdump] / smbutil.c
index 505a271d9363f5de660a212b714789c7e12bf743..8d2d4170798080a9252e1b067c923b560404c67e 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -12,7 +12,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.19 2002-04-20 09:42:58 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.21 2002-04-26 05:12:40 guy Exp $";
 #endif
 
 #include <sys/param.h>
@@ -338,7 +338,7 @@ write_bits(unsigned int val, char *fmt)
 
 /* convert a UCS2 string into iso-8859-1 string */
 static const char *
-unistr(const char *s, int *len)
+unistr(const u_char *s, int *len)
 {
     static char buf[1000];
     int l=0;
@@ -354,8 +354,8 @@ unistr(const char *s, int *len)
 
     /* maybe it isn't unicode - a cheap trick */
     if (!use_unicode || (s[0] && s[1])) {
-       *len = strlen(s) + 1;
-       return s;
+       *len = strlen((const char *)s) + 1;
+       return (const char *)s;
     }
 
     *len = 0;
@@ -400,8 +400,11 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
        case '{':
          {
            char bitfmt[128];
-           char *p = strchr(++fmt, '}');
-           int l = PTR_DIFF(p, fmt);
+           char *p;
+           int l;
+
+           p = strchr(++fmt, '}');
+           l = PTR_DIFF(p, fmt);
            strncpy(bitfmt, fmt, l);
            bitfmt[l] = 0;
            fmt = p + 1;
@@ -415,7 +418,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            int l = atoi(fmt + 1);
            buf += l;
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -529,7 +532,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            printf("%-*.*s", l, l, buf);
            buf += l;
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -539,7 +542,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            while (l--)
                printf("%02x", *buf++);
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -571,7 +574,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
                break;
            }
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }
@@ -603,7 +606,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
            }
            printf("%s", t ? asctime(localtime(&t)) : "NULL\n");
            fmt++;
-           while (isdigit(*fmt))
+           while (isdigit((unsigned char)*fmt))
                fmt++;
            break;
          }