summaryrefslogtreecommitdiffstats
path: root/contrib/bmake
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-08-10 21:31:35 +0000
committersjg <sjg@FreeBSD.org>2013-08-10 21:31:35 +0000
commit0e7402e0467f2c12faf1ab60ccb92dec98b5e180 (patch)
tree394ca330f5d8ecccf6fd2cb13b9031696509a049 /contrib/bmake
parentfc8a240c932befded2fb41a38bf6edddb8cae527 (diff)
downloadFreeBSD-src-0e7402e0467f2c12faf1ab60ccb92dec98b5e180.zip
FreeBSD-src-0e7402e0467f2c12faf1ab60ccb92dec98b5e180.tar.gz
ParseGetLine: don't treat a zero byte as end of buffer if P_end says it isn't.
Consume up to next newline, and issue a parse warning. If no newline found before P_end, carry on as before.
Diffstat (limited to 'contrib/bmake')
-rw-r--r--contrib/bmake/parse.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/bmake/parse.c b/contrib/bmake/parse.c
index 928ff4a..5096767 100644
--- a/contrib/bmake/parse.c
+++ b/contrib/bmake/parse.c
@@ -2582,6 +2582,16 @@ ParseGetLine(int flags, int *length)
if (cf->P_end == NULL)
/* End of string (aka for loop) data */
break;
+ /* see if there is more we can parse */
+ while (ptr++ < cf->P_end) {
+ if ((ch = *ptr) == '\n') {
+ if (ptr > line && ptr[-1] == '\\')
+ continue;
+ Parse_Error(PARSE_WARNING,
+ "Zero byte read from file, skipping rest of line.");
+ break;
+ }
+ }
if (cf->nextbuf != NULL) {
/*
* End of this buffer; return EOF and outer logic
OpenPOWER on IntegriCloud