Wireshark-commits: [Wireshark-commits] master 3031247: Don't use the captured length as the packet

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 14 Sep 2014 00:22:26 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=3031247cc3f25b520d69ff5dae48578bc27843e3
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

3031247 by Guy Harris (guy@xxxxxxxxxxxx):

    Don't use the captured length as the packet length.
    
    Add a routine ber_tvb_new_subset_length() used to construct tvbuffs for
    parts of the packet, and have it check the specified length against the
    *reported* length.  NOTE: that routine should really take an item and an
    expert info value as arguments and, if the length is greater than the
    remaining packet length, add an expert info for that.
    
    Also, when counting items in a SEQUENCE-OF:
    
    	keep track of whether we succeeded in counting them, and report
    	an "unknown number of items" if we didn't;
    
    	if the length of an item in the SEQUENCE-OF is so big we get an
    	overflow, just bail out of the count loop and indicate that we
    	didn't succeed in counting them - let the error be reported in
    	the process of dissection.
    
    Change-Id: I32172737baaed35fc9a0e6c19a727a6ac71ddfb2
    Reviewed-on: https://code.wireshark.org/review/4103
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  21adbaa   Don't use the captured length, and don't fetch the version until we need it.
    adds  3031247   Don't use the captured length as the packet length.


Summary of changes:
 epan/dissectors/packet-ber.c |   95 ++++++++++++++++++++----------------------
 1 file changed, 45 insertions(+), 50 deletions(-)