]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-smb.c
travis: try removing the matrix: clause and putting back the Coverity stuff.
[tcpdump] / print-smb.c
index 39125efa8617f720e9e85a9280dc01e7f8bf43b9..402bb71f0c7cd5051d6c0b9103c5e0abb8d2378e 100644 (file)
@@ -374,15 +374,21 @@ print_trans(netdissect_options *ndo,
     if (bcc > 0) {
        smb_fdata(ndo, data1 + 2, f2, maxbuf - (paramlen + datalen), unicodestr);
 
-       if (strcmp((const char *)(data1 + 2), "\\MAILSLOT\\BROWSE") == 0) {
+#define MAILSLOT_BROWSE_STR "\\MAILSLOT\\BROWSE"
+       ND_TCHECK_LEN(data1 + 2, strlen(MAILSLOT_BROWSE_STR) + 1);
+       if (strcmp((const char *)(data1 + 2), MAILSLOT_BROWSE_STR) == 0) {
            print_browse(ndo, param, paramlen, data, datalen);
            return;
        }
+#undef MAILSLOT_BROWSE_STR
 
-       if (strcmp((const char *)(data1 + 2), "\\PIPE\\LANMAN") == 0) {
+#define PIPE_LANMAN_STR "\\PIPE\\LANMAN"
+       ND_TCHECK_LEN(data1 + 2, strlen(PIPE_LANMAN_STR) + 1);
+       if (strcmp((const char *)(data1 + 2), PIPE_LANMAN_STR) == 0) {
            print_ipc(ndo, param, paramlen, data, datalen);
            return;
        }
+#undef PIPE_LANMAN_STR
 
        if (paramlen)
            smb_fdata(ndo, param, f3, min(param + paramlen, maxbuf), unicodestr);
@@ -822,11 +828,12 @@ print_smb(netdissect_options *ndo,
     if (ndo->ndo_vflag > 1)
        ND_PRINT("\n");
 
-    ND_PRINT("SMB PACKET: %s (%s)\n", fn->name, request ? "REQUEST" : "REPLY");
+    ND_PRINT("SMB PACKET: %s (%s)", fn->name, request ? "REQUEST" : "REPLY");
 
     if (ndo->ndo_vflag < 2)
        return;
 
+    ND_PRINT("\n");
     ND_TCHECK_2(buf + 10);
     flags2 = GET_LE_U_2(buf + 10);
     unicodestr = flags2 & 0x8000;
@@ -922,7 +929,6 @@ print_smb(netdissect_options *ndo,
        smboffset = newsmboffset;
     }
 
-    ND_PRINT("\n");
     return;
 trunc:
     nd_print_trunc(ndo);
@@ -1087,7 +1093,6 @@ nbt_tcp_print(netdissect_options *ndo,
            data = smb_fdata(ndo, data, "NBT - Unknown packet type\nType=[B]\n", maxbuf, 0);
            break;
        }
-       ND_PRINT("\n");
     }
     return;
 trunc:
@@ -1243,7 +1248,6 @@ nbt_udp137_print(netdissect_options *ndo,
        smb_fdata(ndo, p, "AdditionalData:\n", maxbuf, 0);
 
 out:
-    ND_PRINT("\n");
     return;
 trunc:
     nd_print_trunc(ndo);
@@ -1327,7 +1331,7 @@ nbt_udp138_print(netdissect_options *ndo,
            print_smb(ndo, data, maxbuf);
     }
 out:
-    ND_PRINT("\n");
+    return;
 }
 
 
@@ -1478,7 +1482,6 @@ netbeui_print(netdissect_options *ndo,
     }
 
 out:
-    ND_PRINT("\n");
     return;
 trunc:
     nd_print_trunc(ndo);
@@ -1511,7 +1514,6 @@ ipx_netbios_print(netdissect_options *ndo,
        if (memcmp(data + i, "\377SMB", 4) == 0) {
            smb_fdata(ndo, data, "\n>>> IPX transport ", data + i, 0);
            print_smb(ndo, data + i, maxbuf);
-           ND_PRINT("\n");
            break;
        }
     }