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

Commits:

d2024f2 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: I75b2108dd68f5bc5cd436bf5b82990089a7116bf
    Reviewed-on: https://code.wireshark.org/review/15200
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    (cherry picked from commit 0bffb1663ecb4229699ba7263f4ed7f9824c5fc0)
    Reviewed-on: https://code.wireshark.org/review/15201
    

Actions performed:

    from  dac16c5   IPv4: use calculated value for Header Length display filter
    adds  d2024f2   Clean up packet length handling.


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