From: Roy Marples Date: Wed, 19 Jul 2023 11:42:49 +0000 (+0100) Subject: privsep: Send only what we have put in the buffer to script env X-Git-Tag: v9.5.2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d421e99d682df2dd6c5eac23db0fc4babb76627;p=thirdparty%2Fdhcpcd.git privsep: Send only what we have put in the buffer to script env Rather then sending the whole buffer size. If there is an error writing the last option, it may not be NUL terminated correctly causing an assert. Even so, we should not write the failed option to the environment either as it would be a false positive for an empty option. --- diff --git a/src/script.c b/src/script.c index 6173b402..45b04f90 100644 --- a/src/script.c +++ b/src/script.c @@ -764,7 +764,7 @@ script_runreason(const struct interface *ifp, const char *reason) #ifdef PRIVSEP if (ctx->options & DHCPCD_PRIVSEP) { if (ps_root_script(ctx, - ctx->script_buf, ctx->script_buflen) == -1) + ctx->script_buf, (size_t)buflen) == -1) logerr(__func__); goto send_listeners; }