Wireshark-commits: [Wireshark-commits] master-2.0 ffee94e: Fix packet length handling.
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Fri, 29 Apr 2016 22:52:34 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=ffee94e57079a65cbf5c055ba77245b70522d22f
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-2.0
Repository: wireshark

Commits:

ffee94e 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: 12395
    Change-Id: Ia70f33b71ff28451190fcf144c333fd1362646b2
    Reviewed-on: https://code.wireshark.org/review/15172
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    (cherry picked from commit f5ec0afb766f19519ea9623152cca3bbe2229500)
    Reviewed-on: https://code.wireshark.org/review/15173
    

Actions performed:

    from  f94b8fe   Fix packet length handling.
    adds  ffee94e   Fix packet length handling.


Summary of changes:
 wiretap/cosine.c |   75 +++++++++++++++++++++---------------------------------
 1 file changed, 29 insertions(+), 46 deletions(-)