I hope no one just committed something on this.
authorsharpe <sharpe@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 16 Nov 1999 07:58:12 +0000 (07:58 +0000)
committersharpe <sharpe@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 16 Nov 1999 07:58:12 +0000 (07:58 +0000)
There was a core dump because of a coding oversight.  Should be fixed
now Gilbert.

Should now handle names of form \<somepipe>

Will screw up if there is no leading slash, but in a non-fatal way, I
think.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1041 f5534014-38df-0310-8fa8-9805f1628bb7

packet-smb.c

index 9715c9f3adafd6fd594378f130f3e720d0bb1fe2..4ba62ab29141411be681a707ac6fed0011b7f871 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for smb packet dissection
  * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
  *
- * $Id: packet-smb.c,v 1.37 1999/11/14 06:54:42 sharpe Exp $
+ * $Id: packet-smb.c,v 1.38 1999/11/16 07:58:12 sharpe Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@unicom.net>
@@ -8870,7 +8870,7 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p
   const char    *TransactName;
   char          *TransactNameCopy;
   char          *trans_type;
-  char          *trans_cmd;
+  char          *trans_cmd, *loc_of_slash;
   guint32       index;
   conversation_t *conversation;
   struct smb_request_key   request_key, *new_request_key;
@@ -9196,9 +9196,14 @@ dissect_transact_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *p
 
     strcpy(TransactNameCopy, TransactName);
     trans_type = TransactNameCopy + 1;  /* Skip the slash */
-    index = strchr(trans_type, '\\') - trans_type;
-    trans_cmd = trans_type + index + 1;
-    trans_type[index] = '\0';
+    loc_of_slash = strchr(trans_type, '\\');
+    if (index) {
+      index = loc_of_slash - trans_type;  /* Make it a real index */
+      trans_cmd = trans_type + index + 1;
+      trans_type[index] = '\0';
+    }
+    else
+      trans_cmd = NULL;
 
     if (!strcmp(trans_type, "MAILSLOT") &&
        !dissect_mailslot_smb(pd, offset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn, trans_cmd, SMB_offset + DataOffset, DataCount)) {