Wireshark-commits: [Wireshark-commits] lts-1.12.1 5386607: Fix packet length handling.
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Fri, 24 Jun 2016 00:07:31 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=5386607e78c9b190ca02a5038c8dccb269ca3ce4
Submitter: Balint Reczey (balint@xxxxxxxxxxxxxxx)
Changed: branch: lts-1.12.1
Repository: wireshark

Commits:

5386607 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: I78ff4e5a429db5d1cf678abd9ac4db4210c92d6b
    Reviewed-on: https://code.wireshark.org/review/15178
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    (cherry picked from commit 7ffa6593529551cd38297a60bc9bc58bdd1d5837)
    Reviewed-on: https://code.wireshark.org/review/16115
    Reviewed-by: Balint Reczey <balint@xxxxxxxxxxxxxxx>
    

Actions performed:

    from  ed57db5   Don't treat the packet length as unsigned.
    adds  5386607   Fix packet length handling.


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