diff --git a/test/suite_text2pcap.py b/test/suite_text2pcap.py index 09e1b638b4..569f5b5eef 100644 --- a/test/suite_text2pcap.py +++ b/test/suite_text2pcap.py @@ -332,6 +332,13 @@ class case_text2pcap_parsing(subprocesstest.SubprocessTestCase): "7f 00 00 01 ff 98 00 13 00 0d b5 48 66 69 72 73\n" self.check_rawip(pdata, 0, 0) + def test_text2pcap_eol_missing(self): + '''Verify that the last LF can be missing.''' + pdata = "0000 45 00 00 21 00 01 00 00 40 11 7c c9 7f 00 00 01\n" \ + "0010 7f 00 00 01 ff 98 00 13 00 0d b5 48 66 69 72 73\n" \ + "0020 74" + self.check_rawip(pdata, 1, 33) + def run_text2pcap_content(test, content, args): testin_file = test.filename_from_id(testin_txt) diff --git a/text2pcap-scanner.l b/text2pcap-scanner.l index f1ef1241fb..3a69a83ba1 100644 --- a/text2pcap-scanner.l +++ b/text2pcap-scanner.l @@ -68,10 +68,9 @@ DIAG_OFF_FLEX %} -hexdigit [0-9A-Fa-f] directive ^#TEXT2PCAP.*\r?\n comment ^[\t ]*#.*\r?\n -byte [0-9A-Fa-f][0-9A-Fa-f][ \t] +byte [0-9A-Fa-f][0-9A-Fa-f][ \t]? byte_eol [0-9A-Fa-f][0-9A-Fa-f]\r?\n offset [0-9A-Fa-f]+[: \t] offset_eol [0-9A-Fa-f]+\r?\n