diff options
Diffstat (limited to 'epan/dissectors/packet-drda.c')
-rw-r--r-- | epan/dissectors/packet-drda.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/epan/dissectors/packet-drda.c b/epan/dissectors/packet-drda.c index 21abce0b9d..a5db7217c7 100644 --- a/epan/dissectors/packet-drda.c +++ b/epan/dissectors/packet-drda.c @@ -666,6 +666,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 iCommand; guint16 iLength; + guint16 iCommandEnd = 0; guint8 iFormatFlags; guint8 iDSSType; @@ -685,13 +686,18 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_append_str(pinfo->cinfo, COL_INFO, " | "); } iPreviousFrameNumber = pinfo->fd->num; - if (tvb_length(tvb) >= 10) + /* There may be multiple DRDA commands in one frame */ + while ((guint) (offset + 10) <= tvb_length(tvb)) { iCommand = tvb_get_ntohs(tvb, offset + 8); iLength = tvb_get_ntohs(tvb, offset + 0); + /* iCommandEnd is the length of the packet up to the end of the current command */ + iCommandEnd += iLength; if (check_col(pinfo->cinfo, COL_INFO)) { + if (offset > 0) + col_append_str(pinfo->cinfo, COL_INFO, " | "); col_append_str(pinfo->cinfo, COL_INFO, val_to_str(iCommand, drda_opcode_abbr, "Unknown (0x%02x)")); } @@ -729,7 +735,7 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(drda_tree, hf_drda_ddm_codepoint, tvb, offset + 8, 2, FALSE); /* The number of attributes is variable */ - for (offset = 10; offset <= iLength; ) + for (offset += 10; offset < iCommandEnd; ) { if (tvb_length_remaining(tvb, offset) >= 2) { @@ -764,6 +770,11 @@ dissect_drda(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } + else + { + /* No tree, advance directly to next command */ + offset += iLength; + } } } |