aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-oampdu.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-07-17 23:26:37 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2014-07-19 12:55:57 +0000
commit30239117ac1364b03a0a000cb79f91d986a3aa60 (patch)
tree698ac7cb0bba226a2dd9fcb8b74cf385116cecdd /epan/dissectors/packet-oampdu.c
parentc21a8a76248c1e6291a735a1e52f20c16c55b4db (diff)
fix bug 9100
object and package containers may have multiple entries Change-Id: I032e78057aadbbe67925d07881da9f1182a24058 Reviewed-on: https://code.wireshark.org/review/3121 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-oampdu.c')
-rw-r--r--epan/dissectors/packet-oampdu.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/epan/dissectors/packet-oampdu.c b/epan/dissectors/packet-oampdu.c
index 4568e4f45c..2fef3e3f38 100644
--- a/epan/dissectors/packet-oampdu.c
+++ b/epan/dissectors/packet-oampdu.c
@@ -1735,7 +1735,7 @@ static void
dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
{
guint16 raw_word;
- guint8 raw_octet;
+ guint8 branch, raw_octet;
guint32 offset;
@@ -1743,16 +1743,16 @@ dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
while (1)
{
- raw_octet = tvb_get_guint8(tvb, offset);
+ branch = tvb_get_guint8(tvb, offset);
- if (raw_octet == 0) break;
+ if (branch == 0) break;
proto_tree_add_uint(tree, hf_oampdu_variable_branch,
- tvb,offset, 1, raw_octet);
+ tvb,offset, 1, branch);
offset+=1;
- switch (raw_octet)
+ switch (branch)
{
case OAMPDU_VARS_OBJECT:
{
@@ -1788,31 +1788,35 @@ dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
offset+=2;
- raw_octet = tvb_get_guint8(tvb, offset);
-
- if (raw_octet >= 0x80)
- {
- /* Variable Indication */
- proto_tree_add_uint(tree, hf_oampdu_variable_indication,
- tvb,offset, 1, (raw_octet&0x7F));
-
- offset+=1;
- }
- else
- {
- /* Special case for 128 bytes container */
- if (raw_octet == 0) raw_octet = 128;
+ do {
+ raw_octet = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(tree, hf_oampdu_variable_width,
- tvb,offset, 1, raw_octet);
+ if (raw_octet >= 0x80) {
+ /* Variable Indication */
+ proto_tree_add_uint(tree, hf_oampdu_variable_indication,
+ tvb,offset, 1, (raw_octet&0x7F));
+ offset+=1;
+ break;
+ }
+ else {
+ /* Length field and data */
- offset+=1;
+ /* Length field 0 means the length is 128 bytes */
+ if (raw_octet == 0) raw_octet = 128;
- proto_tree_add_item(tree, hf_oampdu_variable_value,
- tvb, offset, raw_octet, ENC_NA);
+ proto_tree_add_uint(tree, hf_oampdu_variable_width,
+ tvb,offset, 1, raw_octet);
+ offset+=1;
- offset+=raw_octet;
- }
+ proto_tree_add_item(tree, hf_oampdu_variable_value,
+ tvb, offset, raw_octet, ENC_NA);
+ offset+=raw_octet;
+ }
+ /* object and package containers consist of multiple entries
+ (variable indication + variable value), the last entry
+ has only the variable indication and no value
+ binding and attribute objects have only one such entry */
+ } while (branch==OAMPDU_VARS_OBJECT || branch==OAMPDU_VARS_PACKAGE);
}
}