Wireshark-commits: [Wireshark-commits] master-1.12 edbed5a: Don't treat the packet length as unsign
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=edbed5a120e878725ed3ba31484045ee7e817e58
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark
Commits:
edbed5a 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/15232
Actions performed:
from 1635420 Don't treat the packet length as unsigned.
adds edbed5a Don't treat the packet length as unsigned.
Summary of changes:
wiretap/toshiba.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)