hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 9ffee143ea0da32f6180ca50948b418e6f86e136
parent 6b189dee3829204db33dec0be275b1d056133092
Author: Sebastian <sebastian@sebsite.pw>
Date:   Thu, 31 Aug 2023 02:11:41 -0400

os::exec: add check for \0 in value

This replicates the check in os::setenv

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mos/exec/cmd.ha | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/os/exec/cmd.ha b/os/exec/cmd.ha @@ -110,10 +110,10 @@ export fn unsetenv(cmd: *command, key: str) (void | errors::invalid) = { }; }; - // Adds or sets a variable in the command environment. This does not affect the // current process environment. The key may not contain '=' or '\0'. export fn setenv(cmd: *command, key: str, value: str) (void | errors::invalid) = { + if (strings::contains(value, '\0')) return errors::invalid; unsetenv(cmd, key)?; append(cmd.env, strings::join("=", key, value)); };