Thread (7 messages) flat view 7 messages, 2 authors, 2016-06-15
STALE3716d

[PATCH v2 2/4] compat/setenv.c: error if name contains '='

From: Erik Faye-Lund <hidden>
Date: 2016-06-15 22:52:38
Subsystem: the rest · Maintainer: Linus Torvalds

According to POSIX, setenv should error out with EINVAL if it's
asked to set an environment variable whose name contains an equals
sign. Implement this detail in our compatibility-fallback.

Signed-off-by: Erik Faye-Lund <redacted>
---
 compat/setenv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/compat/setenv.c b/compat/setenv.c
index 89947b7..fc1439a 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -6,7 +6,7 @@ int gitsetenv(const char *name, const char *value, int replace)
 	size_t namelen, valuelen;
 	char *envstr;
 
-	if (!name || !value) {
+	if (!name || strchr(name, '=') || !value) {
 		errno = EINVAL;
 		return -1;
 	}
-- 
1.7.7.1.msysgit.0.272.g9e47e
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help