diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-03-11 19:49:44 +0100 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-03-12 04:44:24 +0000 |
commit | ba179a7ef7e660d788cbaade65982ffc7249b91f (patch) | |
tree | 4cc6e9e9c0117719429b12e50b4a98259c068449 /epan | |
parent | 7e842fa5514c79046d7d1986b0b379c3d4f9ce2c (diff) |
eth: fix null pointer dereference when called from Lua
At the moment, Lua dissectors always pass a NULL data parameter, so
dissectors like eth should gracefully handle that.
Bug: 14293
Change-Id: Ida4d0530a9c417db5960475274315d4acc3704a8
Fixes: v2.1.0rc0-1575-g8ec153f938 ("Have the "maybe an FCS" version of the Ethernet dissector take a data argument.")
Reviewed-on: https://code.wireshark.org/review/26431
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-eth.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index fb1650fc5e..a6e742e0a2 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -754,6 +754,7 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) struct eth_phdr *eth = (struct eth_phdr *)data; proto_tree *fh_tree; tvbuff_t *real_tvb; + guint fcs_len = eth_assume_fcs ? 4 : (eth ? eth->fcs_len : -1); /* When capturing on a Cisco FEX, some frames (most likely all frames captured without a vntag) have an extra destination mac prepended. */ @@ -792,13 +793,13 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) * no FCS". */ add_ethernet_trailer(pinfo, tree, fh_tree, hf_eth_trailer, real_tvb, next_tvb, - eth_assume_fcs ? 4 : eth->fcs_len); + fcs_len); } else { /* * XXX - this overrides Wiretap saying "this packet definitely has * no FCS". */ - dissect_eth_common(real_tvb, pinfo, tree, eth_assume_fcs ? 4 : eth->fcs_len); + dissect_eth_common(real_tvb, pinfo, tree, fcs_len); } return tvb_captured_length(tvb); } |