Wireshark-commits: [Wireshark-commits] master-1.12 9697999: We can't check the length of an SHB unt

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Tue, 14 Oct 2014 23:59:20 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=96979996506342a50efc92d4b8ad538358c7a763
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark

Commits:

9697999 by Guy Harris (guy@xxxxxxxxxxxx):

    We can't check the length of an SHB until we determine the byte order.
    
    Don't check a possibly-byte-swapped length against the minimum SHB size;
    it'll probably look huge if it's byte-swapped, so the test won't fail
    even if it is too small, and a really huge SHB's length could look too
    small if it's byte-swapped.
    
    Do the check *after* we've read the fixed-length portion of the block;
    yes, that means we've read past the purported size of the block at that
    point, but if that read succeeds, that doesn't matter, and if that read
    fails, it just means we'll report "file cut short" rather than "bad SHB
    length", *both* of which are problems with the file.
    
    (cherry picked from commit 0ac944944233b49c77a77da65be19ce4c2e65647)
    
    Change-Id: Ib0615187b05c692e983ab615872037e9c54ead42
    Reviewed-on: https://code.wireshark.org/review/4693
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  d5af678   Don't log warnings if no block-type handlers are registered.
    adds  9697999   We can't check the length of an SHB until we determine the byte order.


Summary of changes:
 wiretap/pcapng.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)