[Bug 1189] New: Include of a file not robust to missing newline at EOF

bugzilla-daemon at netfilter.org bugzilla-daemon at netfilter.org
Fri Oct 6 19:33:09 CEST 2017


https://bugzilla.netfilter.org/show_bug.cgi?id=1189

            Bug ID: 1189
           Summary: Include of a file not robust to missing newline at EOF
           Product: nftables
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: nft
          Assignee: pablo at netfilter.org
          Reporter: netfilter at allycomm.com

Created attachment 509
  --> https://bugzilla.netfilter.org/attachment.cgi?id=509&action=edit
Files to reproduce missing-newline behavior; no subdirectory

If a file used by an "include" statement does not have a newline at its end, it
will cause a parse/lex issue that is reported elsewhere.  While the trivial
example supplied  that error is immediately after the inclusion, it can be more
difficult to trace down when multiple files are included in the same context.

To Reproduce
============

* In a suitable directory, extract the attached tar (flat files, no
subdirectory)

$ sudo nft -c -f nftables.conf
nftables.conf:17:5-9: Error: syntax error, unexpected chain
    chain inside-nftables-after-no-newline {
    ^^^^^



Suggested resolutions
=====================

* At a minimum, warn if an included file does not have a terminal newline

* If there is not a valid use case for inclusion of a file without a terminal
newline, additionally fix the parser/lexer so that it does not error

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.netfilter.org/pipermail/netfilter-buglog/attachments/20171006/037d4a64/attachment.html>


More information about the netfilter-buglog mailing list