Wireshark-commits: [Wireshark-commits] master-2.0 4a098bb: Fix packet length handling.

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sat, 30 Apr 2016 00:09:42 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=4a098bbe2ec444405dc492d23a36abc2ae908f97
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-2.0
Repository: wireshark

Commits:

4a098bb by Guy Harris (guy@xxxxxxxxxxxx):

    Fix packet length handling.
    
    Treat the packet length as unsigned - it shouldn't be negative in the
    file.  If it is, that'll probably cause the sscanf to fail, so we'll
    report the file as bad.
    
    Check it against WTAP_MAX_PACKET_SIZE to make sure we don't try to
    allocate a huge amount of memory, just as we do in other file readers.
    
    Use the now-validated packet size as the length in
    ws_buffer_assure_space(), so we are certain to have enough space, and
    don't allocate too much space.
    
    Merge the header and packet data parsing routines while we're at it.
    
    Bug: 12396
    Change-Id: I7f981f9cdcbea7ecdeb88bfff2f12d875de2244f
    Reviewed-on: https://code.wireshark.org/review/15176
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    (cherry picked from commit 6a140eca7b78b230f1f90a739a32257476513c78)
    Reviewed-on: https://code.wireshark.org/review/15177
    

Actions performed:

    from  8d0d897   Qt: Make sure we pass along a resizeEvent.
    adds  4a098bb   Fix packet length handling.


Summary of changes:
 wiretap/netscreen.c |  101 ++++++++++++++++++++-------------------------------
 wiretap/netscreen.h |    3 --
 2 files changed, 40 insertions(+), 64 deletions(-)