Updates from Ed Warnicke.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 28 Dec 2000 10:10:17 +0000 (10:10 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 28 Dec 2000 10:10:17 +0000 (10:10 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2793 f5534014-38df-0310-8fa8-9805f1628bb7

plugins/mgcp/ChangeLog
plugins/mgcp/moduleinfo.h
plugins/mgcp/packet-mgcp.c

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..163d606266661303eefcd1a29768fb71a6d9af33 100644 (file)
@@ -0,0 +1,3 @@
+Overview of changes in Ethereal MGCP plugin 0.0.2:
+* Fixed misc problems with improperly dissecting some xgcp packets as 
+  short or malformed.  
index 133e12504e89d162db856bd208070b196f5ff0f6..04cb052c967d23af65fff7b4ae8091a235d08ae5 100644 (file)
@@ -13,5 +13,5 @@
 #endif
 
 /* Version number of package */
-#define VERSION "0.0.1"
+#define VERSION "0.0.2"
 
index fdb070baf19a99194c2dc941c57f7b51c4e74796..09491a133e67a6cebd2c2c6c8c7475061076edc7 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for mgcp packet disassembly
  * RFC 2705
  *
- * $Id: packet-mgcp.c,v 1.10 2000/12/25 09:37:35 guy Exp $
+ * $Id: packet-mgcp.c,v 1.11 2000/12/28 10:10:17 guy Exp $
  * 
  * Copyright (c) 2000 by Ed Warnicke <hagbard@physics.rutgers.edu>
  *
@@ -812,15 +812,18 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb,
       my_proto_tree_add_string = proto_tree_add_string_hidden;
     }
 
-    tvb_current_offset = tvb_find_guint8(tvb,tvb_previous_offset,
-                                            tvb_current_len, ' ');
-    if(tvb_current_offset == -1){
-      tvb_current_offset = tvb_len;
-    }
-    tvb_current_len = tvb_length_remaining(tvb,tvb_previous_offset);
-    tokenlen = tvb_current_offset - tvb_previous_offset;
+    do {
+      tvb_current_len = tvb_length_remaining(tvb,tvb_previous_offset);
+      tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset,
+                                          tvb_current_len, ' ');
+      if(tvb_current_offset == -1){
+       tvb_current_offset = tvb_len;
+       tokenlen = tvb_current_len;
+      }                                  
+      else{
+       tokenlen = tvb_current_offset - tvb_previous_offset;
+      }
 
-    while( tvb_current_offset < tvb_len || tokennum <= 3){
       if(tokennum == 0){
        if(is_mgcp_verb(tvb,tvb_previous_offset,tvb_current_len)){
          mgcp_type = MGCP_REQUEST;
@@ -849,38 +852,46 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb,
       if(tokennum == 2){
        if(mgcp_type == MGCP_REQUEST){
          my_proto_tree_add_string(tree,hf_mgcp_req_endpoint, tvb,
-                               tvb_previous_offset, tokenlen,
-                               tvb_format_text(tvb, tvb_previous_offset,
-                                               tokenlen));
+                                  tvb_previous_offset, tokenlen,
+                                  tvb_format_text(tvb, tvb_previous_offset,
+                                                  tokenlen));
        }
        else if(mgcp_type == MGCP_RESPONSE){
-         tokenlen = tvb_find_line_end(tvb, tvb_previous_offset, 
-                                      -1,&tvb_current_offset);
-         my_proto_tree_add_string(tree,hf_mgcp_rsp_rspstring, tvb,
+         if(tvb_current_offset < tvb_len){
+           tokenlen = tvb_find_line_end(tvb, tvb_previous_offset, 
+                                        -1,&tvb_current_offset);
+         }
+         else{
+           tokenlen = tvb_current_len;
+         }
+         my_proto_tree_add_string(tree, hf_mgcp_rsp_rspstring, tvb,
                                   tvb_previous_offset, tokenlen,
-                                  tvb_format_text(tvb,tvb_previous_offset,
+                                  tvb_format_text(tvb, tvb_previous_offset,
                                                   tokenlen));
-         break;
-       }
+         }
+       break;
       }
       if( (tokennum == 3 && mgcp_type == MGCP_REQUEST) ){
-       tokenlen = tvb_find_line_end(tvb, tvb_previous_offset, 
-                                    -1,&tvb_current_offset);
+       if(tvb_current_offset < tvb_len ){
+         tokenlen = tvb_find_line_end(tvb, tvb_previous_offset, 
+                                      -1,&tvb_current_offset);
+       }
+       else{
+         tokenlen = tvb_current_len;
+       }
        my_proto_tree_add_string(tree,hf_mgcp_version, tvb,
                                 tvb_previous_offset, tokenlen,
                                 tvb_format_text(tvb,tvb_previous_offset,
                                                 tokenlen));
        break;
       }
-      tvb_previous_offset = tvb_skip_wsp(tvb, tvb_current_offset,
-                                        tvb_current_len);
-      tvb_current_len = tvb_length_remaining(tvb,tvb_previous_offset);
-      tvb_current_offset = tvb_find_guint8(tvb,tvb_previous_offset,
-                                          tvb_current_len, ' ');
-      tokenlen = tvb_current_offset - tvb_previous_offset;
+      if(tvb_current_offset < tvb_len){
+       tvb_previous_offset = tvb_skip_wsp(tvb, tvb_current_offset,
+                                          tvb_current_len);
+      }
       tokennum++;
-    }
-  
+    } while( tvb_current_offset < tvb_len && tvb_previous_offset < tvb_len 
+            && tokennum <= 3);
     switch (mgcp_type){
     case MGCP_RESPONSE:
       proto_tree_add_boolean_hidden(tree,hf_mgcp_rsp, NullTVB,0,0,1);
@@ -972,8 +983,13 @@ static void dissect_mgcp_params(tvbuff_t *tvb, packet_info *pinfo,
  */
 static gint tvb_skip_wsp(tvbuff_t* tvb, gint offset, gint maxlength){
   gint counter = offset;
-  gint end = offset + maxlength;
+  gint end = offset + maxlength,tvb_len;
   guint8 tempchar;
+  tvb_len = tvb_length(tvb);
+  end = offset + maxlength;
+  if(end >= tvb_len){
+    end = tvb_len;
+  }
   for(counter = offset; counter < end && 
        ((tempchar = tvb_get_guint8(tvb,counter)) == ' ' || 
        tempchar == '\t');counter++);