Wireshark-commits: [Wireshark-commits] master-2.0 f5e7e03: Don't treat the packet length as unsigne

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

Commits:

f5e7e03 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>
    (cherry picked from commit 3270dfac43da861c714df76513456b46765ff47f)
    Reviewed-on: https://code.wireshark.org/review/15231
    

Actions performed:

    from  45fc804   Don't treat the packet length as unsigned.
    adds  f5e7e03   Don't treat the packet length as unsigned.


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