aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rpcrdma.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2016-12-06 11:25:59 -0500
committerAnders Broman <a.broman58@gmail.com>2016-12-07 08:51:24 +0000
commitf39389e945e11a82905bc5b71ada85f3b90e9bab (patch)
tree57ccfe8234ebfee6472f5614547d346d7c12eb4b /epan/dissectors/packet-rpcrdma.c
parent29768d91ec60023cc68cb38edc492a6d2221f662 (diff)
packet-rpcrdma: Fix selection size in chunk list dissectors
Use proto_item_set_len instead of walking the packet ahead of time trying to compute the size. Change-Id: I5eb3da1fef45895853cb5b6b198d0310394e4176 Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-on: https://code.wireshark.org/review/19120 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-rpcrdma.c')
-rw-r--r--epan/dissectors/packet-rpcrdma.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/epan/dissectors/packet-rpcrdma.c b/epan/dissectors/packet-rpcrdma.c
index 6cbfc7711e..f02cbf8b76 100644
--- a/epan/dissectors/packet-rpcrdma.c
+++ b/epan/dissectors/packet-rpcrdma.c
@@ -260,16 +260,14 @@ static guint dissect_rpcrdma_read_chunk(proto_tree *read_list,
static guint dissect_rpcrdma_read_list(tvbuff_t *tvb, guint offset,
proto_tree *tree)
{
- guint reported_length = tvb_reported_length(tvb);
- guint selection_size, chunk_count;
+ guint chunk_count, start = offset;
proto_tree *read_list;
guint32 value_follows;
proto_item *item;
- selection_size = get_read_list_size(tvb, reported_length, offset);
chunk_count = get_read_list_chunk_count(tvb, offset);
item = proto_tree_add_uint_format(tree, hf_rpcordma_reads_count,
- tvb, offset, selection_size, chunk_count,
+ tvb, offset, 0, chunk_count,
"Read list (count: %u)", chunk_count);
read_list = proto_item_add_subtree(item, ett_rpcordma_read_list);
@@ -283,6 +281,7 @@ static guint dissect_rpcrdma_read_list(tvbuff_t *tvb, guint offset,
offset = dissect_rpcrdma_read_chunk(read_list, tvb, offset);
}
+ proto_item_set_len(item, offset - start);
return offset;
}
@@ -333,16 +332,14 @@ static guint dissect_rpcrdma_write_chunk(proto_tree *write_list,
static guint dissect_rpcrdma_write_list(tvbuff_t *tvb, guint offset,
proto_tree *tree)
{
- guint reported_length = tvb_reported_length(tvb);
- guint selection_size, chunk_count;
+ guint chunk_count, start = offset;
proto_tree *write_list;
guint32 value_follows;
proto_item *item;
- selection_size = get_write_list_size(tvb, reported_length, offset);
chunk_count = get_write_list_chunk_count(tvb, offset);
item = proto_tree_add_uint_format(tree, hf_rpcordma_writes_count,
- tvb, offset, selection_size, chunk_count,
+ tvb, offset, 0, chunk_count,
"Write list (count: %u)", chunk_count);
write_list = proto_item_add_subtree(item, ett_rpcordma_write_list);
@@ -356,22 +353,21 @@ static guint dissect_rpcrdma_write_list(tvbuff_t *tvb, guint offset,
offset = dissect_rpcrdma_write_chunk(write_list, tvb, offset);
}
+ proto_item_set_len(item, offset - start);
return offset;
}
static guint dissect_rpcrdma_reply_chunk(tvbuff_t *tvb, guint offset,
proto_tree *tree)
{
- guint reported_length = tvb_reported_length(tvb);
- guint32 selection_size, chunk_count;
+ guint32 chunk_count, start = offset;
proto_tree *reply_chunk;
guint32 value_follows;
proto_item *item;
- selection_size = get_reply_chunk_size(tvb, reported_length, offset);
chunk_count = get_reply_chunk_count(tvb, offset);
item = proto_tree_add_uint_format(tree, hf_rpcordma_reply_count,
- tvb, offset, selection_size, chunk_count,
+ tvb, offset, 0, chunk_count,
"Reply chunk (count: %u)", chunk_count);
reply_chunk = proto_item_add_subtree(item, ett_rpcordma_reply_chunk);
@@ -381,7 +377,9 @@ static guint dissect_rpcrdma_reply_chunk(tvbuff_t *tvb, guint offset,
if (!value_follows)
return offset;
- return dissect_rpcrdma_write_chunk(reply_chunk, tvb, offset);
+ offset = dissect_rpcrdma_write_chunk(reply_chunk, tvb, offset);
+ proto_item_set_len(item, offset - start);
+ return offset;
}
static guint parse_rdma_header(tvbuff_t *tvb, guint offset, proto_tree *tree)