|
From: <sv...@va...> - 2011-05-04 09:02:07
|
Author: sewardj
Date: 2011-05-04 10:01:58 +0100 (Wed, 04 May 2011)
New Revision: 11721
Log:
VG_(env_unsetenv), VG_(env_clone): add assertions so as to cause
assertions instead of segfaults. Potential segfaults were detected by
IBM's BEAM checker.
Modified:
trunk/coregrind/m_libcproc.c
Modified: trunk/coregrind/m_libcproc.c
===================================================================
--- trunk/coregrind/m_libcproc.c 2011-05-03 14:24:11 UTC (rev 11720)
+++ trunk/coregrind/m_libcproc.c 2011-05-04 09:01:58 UTC (rev 11721)
@@ -91,8 +91,10 @@
void VG_(env_unsetenv) ( Char **env, const Char *varname )
{
- Char **from;
- Char **to = NULL;
+ Char **from, **to;
+ vg_assert(env);
+ vg_assert(varname);
+ to = NULL;
Int len = VG_(strlen)(varname);
for (from = to = env; from && *from; from++) {
@@ -302,6 +304,7 @@
Char **newenv;
Int envlen;
+ vg_assert(oldenv);
for (oldenvp = oldenv; oldenvp && *oldenvp; oldenvp++);
envlen = oldenvp - oldenv + 1;
|