diff --git a/epan/expert.c b/epan/expert.c index 32a5d4b27d..b9737d4e4d 100644 --- a/epan/expert.c +++ b/epan/expert.c @@ -641,9 +641,7 @@ proto_tree_add_expert_internal(proto_tree *tree, packet_info *pinfo, expert_fiel va_end(unused); /* But make sure it throws an exception *after* adding the item */ - if (length == -1) { - length = tvb_captured_length(tvb) ? tvb_ensure_captured_length_remaining(tvb, start) : 0; - } else { + if (length != -1) { tvb_ensure_bytes_exist(tvb, start, length); } return ti; @@ -684,9 +682,7 @@ proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field va_end(ap); /* But make sure it throws an exception *after* adding the item */ - if (length == -1) { - length = tvb_captured_length(tvb) ? tvb_ensure_captured_length_remaining(tvb, start) : 0; - } else { + if (length != -1) { tvb_ensure_bytes_exist(tvb, start, length); } return ti;