summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorscf <scf@FreeBSD.org>2009-12-06 23:27:24 +0000
committerscf <scf@FreeBSD.org>2009-12-06 23:27:24 +0000
commitcc8ac328443112ba8c2be9eaa80fc4e9b6e71fa6 (patch)
tree5b907898fd0f13301bed20c425aa1ea11a36371b /lib
parent3a10c0221346669ddb9b9d2f336620cf12c44254 (diff)
downloadFreeBSD-src-cc8ac328443112ba8c2be9eaa80fc4e9b6e71fa6.zip
FreeBSD-src-cc8ac328443112ba8c2be9eaa80fc4e9b6e71fa6.tar.gz
Change the behavior of setenv(), putenv() and unsetenv() to continue parsing
instead of returning an error if a corrupt (not a "name=value" string) entry in the environ array is detected when (re)-building the internal environment. This should prevent applications or libraries from experiencing issues arising from the expectation that these calls will complete even with corrupt entries. The behavior is now as it was prior to 7.0. Reviewed by: jilles MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/getenv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index b7826d7..4617f45 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -361,8 +361,7 @@ __build_env(void)
} else {
__env_warnx(CorruptEnvValueMsg, envVars[envNdx].name,
strlen(envVars[envNdx].name));
- errno = EFAULT;
- goto Failure;
+ continue;
}
/*
@@ -377,8 +376,7 @@ __build_env(void)
false) == NULL) {
__env_warnx(CorruptEnvFindMsg, envVars[envNdx].name,
nameLen);
- errno = EFAULT;
- goto Failure;
+ continue;
}
envVars[activeNdx].active = true;
}
@@ -560,8 +558,7 @@ __merge_environ(void)
if ((equals = strchr(*env, '=')) == NULL) {
__env_warnx(CorruptEnvValueMsg, *env,
strlen(*env));
- errno = EFAULT;
- return (-1);
+ continue;
}
if (__setenv(*env, equals - *env, equals + 1,
1) == -1)
OpenPOWER on IntegriCloud