Wireshark-commits: [Wireshark-commits] master-1.12 4ef0da6: Clean up packet length handling.
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sat, 30 Apr 2016 18:36:38 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=4ef0da62a400deefacd9c79e621552556007782a
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark

Commits:

4ef0da6 by Guy Harris (guy@xxxxxxxxxxxx):

    Clean up 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.
    
    A normal packet should be Ethernet-sized; initially make the buffer big
    enough for a maximum-sized Ethernet packet.
    
    Once we know the payload length, check to make sure the packet length
    won't be > WTAP_MAX_PACKET_SIZE and fail if it will.  Then boost the
    buffer size to be large enough for the packet, even if it's bigger than
    a maximum-sized Ethernet packet.
    
    Change-Id: Ide97ece89bbc460795324786a612a20dc55a2ab3
    Reviewed-on: https://code.wireshark.org/review/15202
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  02d6cd3   Check for packets bigger than WTAP_MAX_PACKET_SIZE.
    adds  4ef0da6   Clean up packet length handling.


Summary of changes:
 wiretap/dbs-etherwatch.c |   32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)