TMP: parse with (wrong) lenght as multiple of 2
authorGregor Beck <gbeck@sernet.de>
Tue, 7 Jan 2014 08:44:03 +0000 (09:44 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 29 Jan 2014 08:18:27 +0000 (09:18 +0100)
epan/dissectors/packet-dcerpc.c

index 8ecead7819c61992a1d12ca7dcc3230ee7e6c9c3..448c866b9abbf4afe788bb687dce0c50596b3f56 100644 (file)
@@ -3014,11 +3014,11 @@ dissect_verification_trailer(tvbuff_t *tvb, int stub_offset,
 
        while (remaining >= 4) {
                sec_vt_command cmd;
-               guint16 len;
+               guint16 len, len_missalign;
                gboolean cmd_end, cmd_must;
-
                proto_item *ti;
                proto_tree *tr;
+
                cmd = (sec_vt_command)tvb_get_letohs(tvb, offset);
                len = tvb_get_letohs(tvb, offset + 2);
                cmd_end = cmd & SEC_VT_COMMAND_END;
@@ -3045,7 +3045,7 @@ dissect_verification_trailer(tvbuff_t *tvb, int stub_offset,
                offset += 2;
 
                proto_tree_add_item(tr, hf_dcerpc_sec_vt_command_length, tvb,
-                                   offset, 2, ENC_LITTLE_ENDIAN);
+                                    offset, 2, ENC_LITTLE_ENDIAN);
                offset += 2;
 
                switch (cmd) {
@@ -3064,6 +3064,16 @@ dissect_verification_trailer(tvbuff_t *tvb, int stub_offset,
 
                offset += len;
                remaining -= (4 + len);
+
+                len_missalign = len & 1;
+
+                if (len_missalign) {
+                    int l = 2-len_missalign;
+                    proto_tree_add_text(tr, tvb, offset, l, "missalign");
+                    offset += l;
+                    remaining -= l;
+                }
+
                proto_item_set_end(ti, tvb, offset);
 
                if (cmd & SEC_VT_COMMAND_END) {