NBSS: take into account snaplen when creating the TVB subset

Otherwise you can trigger an exception interrupting the packet dissection
when the snaplen defined is shorter than the payload length

Bug: 14598
Change-Id: Ibeb6482495ed67c7669574bdcd7c429523318428
Reviewed-on: https://code.wireshark.org/review/26858
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
Pascal Quantin 2018-04-10 17:11:24 +02:00 committed by Martin Kaiser
parent b886193309
commit 526a328d83
1 changed files with 1 additions and 4 deletions

View File

@ -1669,10 +1669,7 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
* Construct a tvbuff containing the amount of the payload we have
* available. Make its reported length the amount of data in the PDU.
*/
length = length_remaining;
if (length > plen)
length = plen;
next_tvb = tvb_new_subset_length_caplen(tvb, offset, length, plen);
next_tvb = tvb_new_subset_length(tvb, offset, plen);
dissect_nbss_packet(next_tvb, pinfo, tree, is_cifs);