]> The Tcpdump Group git mirrors - tcpdump/blobdiff - smbutil.c
Compile with '-Wsign-compare' in devel mode if supported
[tcpdump] / smbutil.c
index a3a84b99fd1931132296ca0426f9c3148ae21ca9..0c1bb23a3be1decabea725e688df2c9f19d29ef1 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -235,11 +235,11 @@ name_len(netdissect_options *ndo,
     c = EXTRACT_U_1(s);
     if ((c & 0xC0) == 0xC0)
        return(2);
-    while (*s) {
+    while (EXTRACT_U_1(s)) {
        if (s >= maxbuf)
            return(-1); /* name goes past the end of the buffer */
        ND_TCHECK_1(s);
-       s += (*s) + 1;
+       s += EXTRACT_U_1(s) + 1;
        ND_TCHECK_1(s);
     }
     return(PTR_DIFF(s, s0) + 1);
@@ -318,8 +318,7 @@ smb_data_print(netdissect_options *ndo, const u_char *buf, u_int len)
     return;
 
 trunc:
-    ND_PRINT("\n");
-    ND_PRINT("WARNING: Short packet. Try increasing the snap length\n");
+    nd_print_trunc(ndo);
 }
 
 
@@ -468,7 +467,7 @@ smb_fdata1(netdissect_options *ndo,
            l = PTR_DIFF(p, fmt);
 
            if (l > sizeof(bitfmt) - 1)
-                   l = sizeof(bitfmt)-1;
+               l = sizeof(bitfmt)-1;
 
            strncpy(bitfmt, fmt, l);
            bitfmt[l] = '\0';
@@ -815,8 +814,7 @@ smb_fdata1(netdissect_options *ndo,
     return(buf);
 
 trunc:
-    ND_PRINT("\n");
-    ND_PRINT("WARNING: Short packet. Try increasing the snap length\n");
+    nd_print_trunc(ndo);
     return(NULL);
 }