aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-06-27 14:45:03 +0200
committerAnders Broman <a.broman58@gmail.com>2016-07-02 07:38:37 +0000
commitb78dd096f40adef2ffd0ddd4ef8aee1ea7ca54e6 (patch)
treefd7d81d8cbf72c242fa40b7f8ad50929013f5c9b /epan/proto.c
parent7ad9db8371f5dc86260aaf3bde1da650d11bf6d1 (diff)
proto.c: allow calling get_hfi_length() with a 0 byte tvb and length=-1
As indicated in the comment, we allow FT_PROTOCOL, FT_NONE, FT_BYTES, FT_STRING and FT_STRINGZPAD to be zero-length. But in that case do not call tvb_ensure_captured_length_remaining() that ensures that at least 1 byte is present. Bug: 12561 Change-Id: I881754368c24d334b88f0dda1d59a68e08219227 Reviewed-on: https://code.wireshark.org/review/16167 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 07c8288f43..04eb5c3cf4 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -4504,7 +4504,7 @@ get_hfi_length(header_field_info *hfinfo, tvbuff_t *tvb, const gint start, gint
* of the tvbuff: we throw an exception in that
* case.
*/
- *length = tvb_ensure_captured_length_remaining(tvb, start);
+ *length = tvb_captured_length(tvb) ? tvb_ensure_captured_length_remaining(tvb, start) : 0;
DISSECTOR_ASSERT(*length >= 0);
break;