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

Commits:

f94b8fe 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.
    
    Bug: 12394
    Change-Id: Ifa023ce70f7a2697bf151009b035a6e6cf8d5d90
    Reviewed-on: https://code.wireshark.org/review/15169
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    (cherry picked from commit 5efb45231671baa2db2011d8f67f9d6e72bc455b)
    Reviewed-on: https://code.wireshark.org/review/15170
    

Actions performed:

    from  0313eda   ANSI IS-637 A: fix display of reserved bits when using 7bits GSM encoding
    adds  f94b8fe   Fix packet length handling.


Summary of changes:
 wiretap/toshiba.c |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)