Module Name: src Committed By: rillig Date: Sun Dec 6 20:33:44 UTC 2020
Modified Files: src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: opt-file.exp opt-file.mk Log Message: make(1): error out on null bytes in makefiles Makefiles are text files, they must not contain null bytes. The previous code in this area was rotten anyway. It assumed that buf_end could be NULL even if buf_ptr was a valid pointer, which is no longer true, probably since a few years already. Continuing parsing after a null byte does not make sense. If there's a null byte in a text file, that file is corrupted, and parsing it leads to unintended effects easily. Therefore the only sensible action is to stop parsing immediately. The check whether cf->readMore could be null was outdated as well, which previously made the fatal error impossible to reach. Because of the missing unit tests, nobody noticed this though. The "exit status 0" in opt-file.exp is worring but that's due to another bug and will be fixed in a follow-up commit. To generate a diff of this commit: cvs rdiff -u -r1.471 -r1.472 src/usr.bin/make/parse.c cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-file.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt-file.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.