This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.21-199-g2ecccae
- From: eggert at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 13 Mar 2015 17:14:13 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.21-199-g2ecccae
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 2ecccaede9097f867284d352a881d8f226ba4fb7 (commit)
from cdaf79d0af439ade496a1f6235f503e491502cd6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2ecccaede9097f867284d352a881d8f226ba4fb7
commit 2ecccaede9097f867284d352a881d8f226ba4fb7
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu Mar 12 15:57:07 2015 -0700
* stdlib/setenv.c (__add_to_environ):
Dump core quickly if setenv (..., NULL, ...) is called.
diff --git a/ChangeLog b/ChangeLog
index fb1591f..3b12552 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ * stdlib/setenv.c (__add_to_environ):
+ Dump core quickly if setenv (..., NULL, ...) is called.
+
2015-03-13 Roland McGrath <roland@hack.frob.com>
* sysdeps/arm/tls-macros.h: Include <sysdep.h>.
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index b60c4f0..0534236 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -114,8 +114,16 @@ __add_to_environ (name, value, combined, replace)
{
char **ep;
size_t size;
+
+ /* Compute lengths before locking, so that the critical section is
+ less of a performance bottleneck. VALLEN is needed only if
+ COMBINED is non-null. Also, testing COMBINED instead of VALUE
+ causes setenv (..., NULL, ...) to dump core now instead of
+ corrupting memory later. */
const size_t namelen = strlen (name);
- const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
+ size_t vallen;
+ if (combined != NULL)
+ vallen = strlen (value) + 1;
LOCK;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
stdlib/setenv.c | 10 +++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
hooks/post-receive
--
GNU C Library master sources