summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57590c7)
raw | patch | inline | side by side (parent: 57590c7)
author | Erik Faye-Lund <kusmabite@gmail.com> | |
Wed, 14 Dec 2011 14:07:09 +0000 (15:07 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 15 Dec 2011 03:31:03 +0000 (19:31 -0800) |
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 <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/setenv.c | patch | blob | history |
diff --git a/compat/setenv.c b/compat/setenv.c
index 89947b7134a7671c7f035e48bf8cd5f3ce4bc7c4..fc1439a6439393ff5224e98ab126607ceaa4994d 100644 (file)
--- a/compat/setenv.c
+++ b/compat/setenv.c
size_t namelen, valuelen;
char *envstr;
- if (!name || !value) {
+ if (!name || strchr(name, '=') || !value) {
errno = EINVAL;
return -1;
}