From c9dbf6ad8c7c3320800bf9158b718c6c98a602f5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 12 Jul 2009 18:19:07 +0200 Subject: [PATCH] remove wrong! string terminator detection metze --- epan/dissectors/packet-dcerpc.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index a45ea6e25a..1f7752d023 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -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); -- 2.34.1