remove wrong! string terminator detection ws-metze-gssapi-20090712
authorStefan Metzmacher <metze@samba.org>
Sun, 12 Jul 2009 16:19:07 +0000 (18:19 +0200)
committerStefan Metzmacher <metze@samba.org>
Sun, 12 Jul 2009 16:26:57 +0000 (18:26 +0200)
metze

epan/dissectors/packet-dcerpc.c

index a45ea6e25a2cff2ebd9bf5af281274a699bc1d10..1f7752d0236f9e41d877dc6855878cb6381aaaba 100644 (file)
@@ -1332,9 +1332,8 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo,
     dcerpc_info *di;
     proto_item *string_item;
     proto_tree *string_tree;
-    guint32 len, buffer_len,buffer_len2, max;
+    guint32 len, buffer_len;
     char *s;
-    guint8* buf;
     header_field_info *hfinfo;
 
     di=pinfo->private_data;
@@ -1355,7 +1354,7 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo,
     /* NDR array header */
 
     offset = dissect_ndr_uint32(tvb, offset, pinfo, string_tree, drep,
-                                hf_dcerpc_array_max_count, &max);
+                                hf_dcerpc_array_max_count, NULL);
 
     offset = dissect_ndr_uint32(tvb, offset, pinfo, string_tree, drep,
                                 hf_dcerpc_array_offset, NULL);
@@ -1363,26 +1362,11 @@ dissect_ndr_cvstring(tvbuff_t *tvb, int offset, packet_info *pinfo,
     offset = dissect_ndr_uint32(tvb, offset, pinfo, string_tree, drep,
                                 hf_dcerpc_array_actual_count, &len);
     buffer_len = size_is * len;
-    buffer_len2 = size_is * max;
     hfinfo = proto_registrar_get_nth(hfindex);
 
     /* Adjust offset */
     if (offset % size_is)
         offset += size_is - (offset % size_is);
-    if( buffer_len2 != buffer_len && hfinfo->type == FT_STRING && tvb_reported_length_remaining(tvb,offset) > (gint)buffer_len2) {
-      /* Max can be bigger that len 
-       * if the packet is comming from windows it normally means that the 
-       * last two bytes are null terminators. In this case we change the length
-       * in order to consume them ...
-       * If it's from samba then it's more unlikely to be terminator so we carefully check if
-       * it's null terminators or not in order to know if we should consume them */
-
-      buf = ep_alloc(sizeof(guint8)*buffer_len2);
-      tvb_memcpy(tvb,buf,offset,buffer_len2);
-      if( buf[buffer_len2-2] == 0x0 && buf[buffer_len2-1] == 0x0) {
-        buffer_len = buffer_len2;
-      }
-    }
     if (size_is == sizeof(guint16)) {
         /* XXX - use drep to determine the byte order? */
         s = tvb_fake_unicode(tvb, offset, buffer_len / 2, TRUE);