From 44ace77355798c8d6a72e8b09577dbb80c68441f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 15 Jun 2009 13:10:01 +0000 Subject: [PATCH] Return EINVAL in setenv() if var is NULL or the empty string to match glibc behavior. --- env.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/env.c b/env.c index 7e8f31fc9..a206b45ae 100644 --- a/env.c +++ b/env.c @@ -253,6 +253,9 @@ setenv(var, val, overwrite) const char *cp; size_t esize; + if (!var || *var == '\0') + return(EINVAL); + /* * POSIX says a var name with '=' is an error but BSD * just ignores the '=' and anything after it.