about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/setenv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index a19771391d..48aaecffe0 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -265,6 +265,12 @@ setenv (name, value, replace)
      const char *value;
      int replace;
 {
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   return __add_to_environ (name, value, NULL, replace);
 }