diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2009-06-04 20:39:14 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2009-06-04 20:39:14 +0000 |
commit | 6eee604548590a9567b95d6f5f06fbf6012f21a4 (patch) | |
tree | c4fee953865b48e9dbe566ac8e2719f823f5e427 /lib/libc | |
parent | 7a9cd2077212ecfa7fb84d9a02832dd294a495b4 (diff) |
Don't assume that we can overwrite strings in the environment.
Someone may have passed a read-only string to putenv() (I'm looking
at you cron!).
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/setenv.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c index 242830d7b9a..2e882cdbe65 100644 --- a/lib/libc/stdlib/setenv.c +++ b/lib/libc/stdlib/setenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setenv.c,v 1.10 2009/06/03 15:52:16 millert Exp $ */ +/* $OpenBSD: setenv.c,v 1.11 2009/06/04 20:39:13 millert Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. @@ -101,11 +101,13 @@ setenv(const char *name, const char *value, int rewrite) if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) { if (!rewrite) return (0); +#if 0 /* XXX - existing entry may not be writable */ if (strlen(C) >= l_value) { /* old larger; copy over */ while ((*C++ = *value++)) ; return (0); } +#endif } else { /* create new slot */ size_t cnt; char **P; |