From f3cb9a77543125d4b478f43e068d2a8272d69a0e Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 18 Dec 2014 19:36:03 +0000 Subject: 34006: unmetafy anything put into the environment --- Src/params.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Src/params.c') diff --git a/Src/params.c b/Src/params.c index 79088d162..b87598a02 100644 --- a/Src/params.c +++ b/Src/params.c @@ -4357,7 +4357,18 @@ arrfixenv(char *s, char **t) int zputenv(char *str) { + char *ptr; DPUTS(!str, "Attempt to put null string into environment."); + /* + * The environment uses NULL-terminated strings, so just + * unmetafy and ignore the length. + */ + for (ptr = str; *ptr && *ptr != Meta; ptr++) + ; + if (*ptr == Meta) { + str = dupstring(str); + unmetafy(str, NULL); + } #ifdef USE_SET_UNSET_ENV /* * If we are using unsetenv() to remove values from the @@ -4366,7 +4377,6 @@ zputenv(char *str) * Unfortunately this is a slightly different interface * from what zputenv() assumes. */ - char *ptr; int ret; for (ptr = str; *ptr && *ptr != '='; ptr++) -- cgit 1.4.1