Ethereal-dev: [Ethereal-dev] packet smb sanity fixes
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Jeroen Ruigrok van der Werven <jruigrok@xxxxxxxxxxxxxxxx>
Date: Wed, 22 Nov 2000 18:31:06 +0100
Some code sanity fixes. Expect more. -- Jeroen Ruigrok van der Werven VIA Net.Works The Netherlands BSD: Technical excellence at its best Network- and systemadministrator D78D D0AD 244D 1D12 C9CA 7152 035C 1138 546A B867 I've come a long way from where I started, but I am not even close to where I'm going...
diff -ruN ethereal/packet-smb-mailslot.c ethereal-new/packet-smb-mailslot.c
--- ethereal/packet-smb-mailslot.c Sun Nov 19 09:54:06 2000
+++ ethereal-new/packet-smb-mailslot.c Wed Nov 22 18:10:21 2000
@@ -141,14 +141,14 @@
/*** Decide what dissector to call based upon the command value ***/
- if (strcmp(command, "BROWSE") == 0) { /* Decode a browse */
+ if (command != NULL && strcmp(command, "BROWSE") == 0) { /* Decode a browse */
return dissect_mailslot_browse(pd, offset, fd, parent, tree,
si, max_data, SMB_offset, errcode, dirn, command,
DataOffset, DataCount);
}
- else if (strcmp(command, "LANMAN") == 0) {
+ else if (command != NULL && strcmp(command, "LANMAN") == 0) {
return dissect_pipe_lanman(pd, offset, fd, parent, tree, si,
max_data, SMB_offset, errcode, dirn, command,
@@ -159,9 +159,10 @@
/* NOTE: may need a look up list to check for the mailslot names passed */
/* by the logon request packet */
- else if ((strncmp(command, "NET", strlen("NET")) == 0)
- || (strcmp(command, "TEMP\\NETLOGON") == 0)
- || (strcmp(command, "MSSP") == 0)){
+ else if (((command != NULL) &&
+ strncmp(command, "NET", strlen("NET")) == 0) ||
+ (strcmp(command, "TEMP\\NETLOGON") == 0) ||
+ (strcmp(command, "MSSP") == 0)){
return dissect_smb_logon(pd, DataOffset, fd, parent, tree,
si, max_data, SMB_offset, errcode, dirn,
diff -ruN ethereal/packet-smb-pipe.c ethereal-new/packet-smb-pipe.c
--- ethereal/packet-smb-pipe.c Mon Sep 11 18:16:03 2000
+++ ethereal-new/packet-smb-pipe.c Wed Nov 22 18:10:21 2000
@@ -1231,7 +1231,7 @@
if (!proto_is_protocol_enabled(proto_smb_lanman))
return 0;
- if (strcmp(command, "LANMAN") == 0) { /* Try to decode a LANMAN */
+ if (command != NULL && strcmp(command, "LANMAN") == 0) { /* Try to decode a LANMAN */
return dissect_pipe_lanman(pd, offset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn, command, DataOffset, DataCount, ParameterOffset, ParameterCount);
diff -ruN ethereal/packet-smb.c ethereal-new/packet-smb.c
--- ethereal/packet-smb.c Sun Nov 19 09:54:06 2000
+++ ethereal-new/packet-smb.c Wed Nov 22 18:10:35 2000
@@ -9507,14 +9507,14 @@
if (!TransactName)
return;
- TransactNameCopy = g_malloc(strlen(TransactName) + 1);
+ TransactNameCopy = g_malloc(TransactName ? strlen(TransactName) + 1 : 1);
/* Should check for error here ... */
- strcpy(TransactNameCopy, TransactName);
+ strcpy(TransactNameCopy, TransactName ? TransactName : "");
if (TransactNameCopy[0] == '\\') {
trans_type = TransactNameCopy + 1; /* Skip the slash */
- loc_of_slash = strchr(trans_type, '\\');
+ loc_of_slash = trans_type ? strchr(trans_type, '\\') : NULL;
}
if (loc_of_slash) {
@@ -9526,9 +9526,9 @@
trans_cmd = NULL;
if ((trans_cmd == NULL) ||
- (((strcmp(trans_type, "MAILSLOT") != 0) ||
+ (((trans_type == NULL || strcmp(trans_type, "MAILSLOT") != 0) ||
!dissect_mailslot_smb(pd, SetupAreaOffset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn, trans_cmd, SMB_offset + DataOffset, DataCount, SMB_offset + ParameterOffset, ParameterCount)) &&
- ((strcmp(trans_type, "PIPE") != 0) ||
+ ((trans_type == NULL || strcmp(trans_type, "PIPE") != 0) ||
!dissect_pipe_smb(pd, offset, fd, parent, tree, si, max_data, SMB_offset, errcode, dirn, trans_cmd, DataOffset, DataCount, ParameterOffset, ParameterCount)))) {
if (ParameterCount > 0) {
- Follow-Ups:
- Re: [Ethereal-dev] packet smb sanity fixes
- From: Richard Sharpe
- Re: [Ethereal-dev] packet smb sanity fixes
- Prev by Date: Re: [Ethereal-dev] CVS Build Problems
- Next by Date: [Ethereal-dev] Re: [ethereal-users] compiling tethereal without GTK
- Previous by thread: [Ethereal-dev] Utility for dumping IEEE 802.11 frames is now available
- Next by thread: Re: [Ethereal-dev] packet smb sanity fixes
- Index(es):