p1: Check for valid tvb before tvb_reported_length

Move the modification of the content item (which adds the length)
inside the check for a valid tvb to avoid calling tvb_reported_length()
with a NULL parameter.

Bug: 12976
Change-Id: I54368584b7c00f7a2937eaec772533ae73d98f80
Reviewed-on: https://code.wireshark.org/review/18050
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2016-10-03 21:09:28 +02:00
parent 1320ea4d57
commit 650c0f93be
2 changed files with 2 additions and 2 deletions

View File

@ -679,9 +679,9 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
/* we can do this now constructed octet strings are supported */
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb);
proto_item_set_text(actx->created_item, "content (%%u bytes)", tvb_reported_length (next_tvb));
if (next_tvb) {
proto_item_set_text(actx->created_item, "content (%%u bytes)", tvb_reported_length (next_tvb));
if (ctx && ctx->content_type_id) {
(void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree, actx->private_data);
} else if (ctx && ctx->report_unknown_content_type) {

View File

@ -3248,9 +3248,9 @@ dissect_p1_Content(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_,
/* we can do this now constructed octet strings are supported */
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb);
proto_item_set_text(actx->created_item, "content (%u bytes)", tvb_reported_length (next_tvb));
if (next_tvb) {
proto_item_set_text(actx->created_item, "content (%u bytes)", tvb_reported_length (next_tvb));
if (ctx && ctx->content_type_id) {
(void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree, actx->private_data);
} else if (ctx && ctx->report_unknown_content_type) {