summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-01-25 23:39:52 +0200
committerGlenn Strauss <gstrauss@gluelogic.com>2019-01-26 16:30:23 -0500
commit3ac7764cfe4d0f4d657972849e234361fee97601 (patch)
tree0e91aafdeaa2895a33b4bcd248ab00c84c914e52
parentb17d3c2407e204fc22ec12cf9811aee1b0e52df2 (diff)
downloadlighttpd1.4-3ac7764cfe4d0f4d657972849e234361fee97601.tar.gz
lighttpd1.4-3ac7764cfe4d0f4d657972849e234361fee97601.zip
[core] Fix recursive include_shell invocations
When the output of include_shell calls include_shell itself, that second invocation must not truncate the buffer used for the outer include_shell. This might sound like a pathological setup in itself, but with e.g. debian's include-conf-enabled.pl, which outputs a list of include statements for all files in /etc/lighttpd/conf-enabled, if any of the *.conf files in that directory invokes include_shell, the parsing of the rest of the files in that directory is effectively aborted. This fixes a regression since commit a46bc4f5de49c742e4bdc6ac7be6a4e567c8d92a in such setups. github: closes #95
-rw-r--r--src/configfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/configfile.c b/src/configfile.c
index f3f69fc1..b359dcbe 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -1437,8 +1437,7 @@ int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
ssize_t rd;
pid_t wpid;
int wstatus;
- buffer *out = srv->tmp_buf;
- buffer_clear(out);
+ buffer *out = buffer_init();
close(fds[1]);
fds[1] = -1;
do {
@@ -1471,6 +1470,7 @@ int config_parse_cmd(server *srv, config_t *context, const char *cmd) {
ret = config_parse(srv, context, &t);
buffer_free(source);
}
+ buffer_free(out);
}
if (-1 != fds[0]) close(fds[0]);
if (-1 != fds[1]) close(fds[1]);