diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2018-05-18 09:03:29 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2018-05-18 11:04:08 +0000 |
commit | beaebe91b14564fb9f86f0726bab09927872721b (patch) | |
tree | 5b9c89fc7cbfaa19e57bc656d59838946fcec997 | |
parent | a55b36c51f83a7b9680824e8ee3a6ce8429ab24b (diff) | |
download | wireshark-beaebe91b14564fb9f86f0726bab09927872721b.tar.gz wireshark-beaebe91b14564fb9f86f0726bab09927872721b.tar.bz2 wireshark-beaebe91b14564fb9f86f0726bab09927872721b.zip |
proto.c: do not dereference a NULL pointer in proto_item_get_len() on first pass
Like the proto_item_set_XXX functions, check proto_item pointer validity
before using it. It can be NULL on first pass for example.
Bug: 14703
Change-Id: I94957e0738d66f99793682dc0ea1c7c0a65ceecd
Reviewed-on: https://code.wireshark.org/review/27629
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
(cherry picked from commit 40dbc0ccf26152a058484368526b7bd70c8928c1)
Reviewed-on: https://code.wireshark.org/review/27636
-rw-r--r-- | epan/proto.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c index 424cd4f6e0..89c46c5096 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -5443,7 +5443,11 @@ proto_item_set_end(proto_item *pi, tvbuff_t *tvb, gint end) int proto_item_get_len(const proto_item *pi) { - field_info *fi = PITEM_FINFO(pi); + field_info *fi; + + if (!pi) + return -1; + fi = PITEM_FINFO(pi); return fi ? fi->length : -1; } |