Wireshark-commits: [Wireshark-commits] master 22cf80d: text2pcap: gracefully handle hexdump without
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=22cf80d30d7310554f7b144a31cbdd14451a6d27
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark
Commits:
22cf80d by Peter Wu (peter@xxxxxxxxxxxxx):
text2pcap: gracefully handle hexdump without trailing LF
When copying hexdumps, the newline might be missing which would result
in a capture file missing one byte in its packet. Adjust the grammar to
recognize the two trailing hexadecimal characters as a "byte".
This is safe because Flex picks the rule that matches the longest input
string. So given "01 ", it will always match all three characters. If
something like "01x" is given, then the "text" rule will be matched (as
before). Only if no more characters are available (such as at the end of
a file), then the rule will match two hexdigits.
Remove the unnecessary hexdigit rule while at it.
Change-Id: I21dc37d684d1c410ce720cb27706a6e54f87f94d
Reviewed-on: https://code.wireshark.org/review/30190
Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
Actions performed:
from 9b72da0 test: increase coverage for text2pcap supported formats
add 22cf80d text2pcap: gracefully handle hexdump without trailing LF
Summary of changes:
test/suite_text2pcap.py | 7 +++++++
text2pcap-scanner.l | 3 +--
2 files changed, 8 insertions(+), 2 deletions(-)