summaryrefslogtreecommitdiff
path: root/src/port/win32env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/win32env.c')
-rw-r--r--src/port/win32env.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/port/win32env.c b/src/port/win32env.c
index b22fbafde40..e1cee683dbf 100644
--- a/src/port/win32env.c
+++ b/src/port/win32env.c
@@ -152,6 +152,13 @@ pgwin32_unsetenv(const char *name)
int res;
char *envbuf;
+ /* Error conditions, per POSIX */
+ if (name == NULL || name[0] == '\0' || strchr(name, '=') != NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
envbuf = (char *) malloc(strlen(name) + 2);
if (!envbuf)
return -1;