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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11721
This commit is contained in:
Julian Seward
2011-05-04 09:01:58 +00:00
parent 555e3b2ccb
commit 8911c2ffa5

View File

@@ -91,8 +91,10 @@ Char *VG_(getenv)(Char *varname)
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 **VG_(env_clone) ( Char **oldenv )
Char **newenv;
Int envlen;
vg_assert(oldenv);
for (oldenvp = oldenv; oldenvp && *oldenvp; oldenvp++);
envlen = oldenvp - oldenv + 1;