Wireshark-commits: [Wireshark-commits] master-1.12 f95b796: Fix packet length handling.
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=f95b7960774e8d6e052edcb768cd030640c8e969
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark
Commits:
f95b796 by Guy Harris (guy@xxxxxxxxxxxx):
Fix 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.
Check it against WTAP_MAX_PACKET_SIZE to make sure we don't try to
allocate a huge amount of memory, just as we do in other file readers.
Use the now-validated packet size as the length in
ws_buffer_assure_space(), so we are certain to have enough space, and
don't allocate too much space.
Merge the header and packet data parsing routines while we're at it.
Bug: 12395
Change-Id: I4bf4f62882cf046e3e4ceffe7ab2ff3b178cd612
Reviewed-on: https://code.wireshark.org/review/15174
Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
Actions performed:
from 303680c Fix packet length handling.
adds f95b796 Fix packet length handling.
Summary of changes:
wiretap/cosine.c | 75 +++++++++++++++++++++---------------------------------
1 file changed, 29 insertions(+), 46 deletions(-)