Wireshark-commits: [Wireshark-commits] master 3270dfa: Don't treat the packet length as unsigned.

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 1 May 2016 23:32:09 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=3270dfac43da861c714df76513456b46765ff47f
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

3270dfa by Guy Harris (guy@xxxxxxxxxxxx):

    Don't treat the packet length as unsigned.
    
    The scanf family of functions are as annoyingly bad at handling unsigned
    numbers as strtoul() is - both of them are perfectly willing to accept a
    value beginning with a negative sign as an unsigned value.  When using
    strtoul(), you can compensate for this by explicitly checking for a '-'
    as the first character of the string, but you can't do that with
    sscanf().
    
    So revert to having pkt_len be signed, and scanning it with %d, but
    check for a negative value and fail if we see a negative value.
    
    Bug: 12394
    Change-Id: I4b19b95f2e1ffc96dac5c91bff6698c246f52007
    Reviewed-on: https://code.wireshark.org/review/15230
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  a66628e   Don't treat the packet length as unsigned.
    adds  3270dfa   Don't treat the packet length as unsigned.


Summary of changes:
 wiretap/toshiba.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)