aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2014-10-13 14:05:29 +0200
committerAnders Broman <a.broman58@gmail.com>2014-10-13 19:18:48 +0000
commitab7f9aa1642d8d071fd76b6e9c13879457103583 (patch)
tree8e33315e5cd3388af171d66f83306fdaf54a4bfd
parent6a9479ecf90ef64f944526354fb26ee876d3ad25 (diff)
BER: Code cleanup in call functions
Change-Id: I0ba958485dffd3cc1e419fb27cf7f2bc492d05fe Reviewed-on: https://code.wireshark.org/review/4643 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-ber.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 30fc423a2d..a92793ddb7 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -1140,25 +1140,17 @@ call_ber_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *p
/* Decoded an ASN.1 tag with a length indicating this
* could be BER encoded data. Try dissecting as unknown BER.
*/
- len = dissect_unknown_ber(pinfo, next_tvb, 0, next_tree);
+ dissect_unknown_ber(pinfo, next_tvb, 0, next_tree);
} else {
proto_tree_add_text(next_tree, next_tvb, 0, length_remaining,
"Unknown Data (%d byte%s)", length_remaining,
plurality(length_remaining, "", "s"));
}
}
-
+ len = length_remaining;
}
- if (len > 0) {
- offset += len;
- } else {
- /*XXX until we change the #.REGISTER signature for _PDU()s
- * into new_dissector_t we have to do this kludge with
- * manually step past the content in the ANY type.
- */
- offset += tvb_length_remaining(tvb, offset);
- }
+ offset += len;
return offset;
}
@@ -1173,8 +1165,7 @@ call_ber_syntax_callback(const char *syntax, tvbuff_t *tvb, int offset, packet_i
if (syntax == NULL ||
(len = dissector_try_string(ber_syntax_dissector_table, syntax, next_tvb, pinfo, tree, NULL)) == 0)
{
- proto_item *item = NULL;
- proto_tree *next_tree = NULL;
+ proto_item *item = NULL;
if (syntax == NULL) {
item = proto_tree_add_expert_format(
@@ -1187,21 +1178,14 @@ call_ber_syntax_callback(const char *syntax, tvbuff_t *tvb, int offset, packet_i
" Contact Wireshark developers if you want this supported",
syntax);
}
- if (item) {
- next_tree = proto_item_add_subtree(item, ett_ber_unknown);
+ if (decode_unexpected) {
+ proto_tree *unknown_tree = proto_item_add_subtree(item, ett_ber_unknown);
+ dissect_unknown_ber(pinfo, next_tvb, 0, unknown_tree);
}
- len = dissect_unknown_ber(pinfo, next_tvb, 0, next_tree);
+ len = tvb_length_remaining(tvb, offset);
}
- if (len > 0) {
- offset += len;
- } else {
- /*XXX until we change the #.REGISTER signature for _PDU()s
- * into new_dissector_t we have to do this kludge with
- * manually step past the content in the ANY type.
- */
- offset += tvb_length_remaining(tvb, offset);
- }
+ offset += len;
return offset;
}