|
From: <sv...@va...> - 2011-08-23 10:15:49
|
Author: tom
Date: 2011-08-23 11:11:02 +0100 (Tue, 23 Aug 2011)
New Revision: 12001
Log:
Make a copy of any environment string we are going to modify when
we are cleaning up the environment before an exec, otherwise we
will seg fault if the string is read only. Fixes #270326.
Modified:
trunk/coregrind/m_libcproc.c
Modified: trunk/coregrind/m_libcproc.c
===================================================================
--- trunk/coregrind/m_libcproc.c 2011-08-23 07:35:42 UTC (rev 12000)
+++ trunk/coregrind/m_libcproc.c 2011-08-23 10:11:02 UTC (rev 12001)
@@ -241,14 +241,14 @@
// - DYLD_INSERT_LIBRARIES and DYLD_SHARED_REGION are Darwin-only
for (i = 0; envp[i] != NULL; i++) {
if (VG_(strncmp)(envp[i], "LD_PRELOAD=", 11) == 0)
- ld_preload_str = &envp[i][11];
+ ld_preload_str = VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.1", &envp[i][11]);
if (VG_(strncmp)(envp[i], "LD_LIBRARY_PATH=", 16) == 0)
- ld_library_path_str = &envp[i][16];
+ ld_library_path_str = VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.2", &envp[i][16]);
if (VG_(strncmp)(envp[i], "DYLD_INSERT_LIBRARIES=", 22) == 0)
- dyld_insert_libraries_str = &envp[i][22];
+ dyld_insert_libraries_str = VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.3", &envp[i][22]);
}
- buf = VG_(arena_malloc)(VG_AR_CORE, "libcproc.erves.1",
+ buf = VG_(arena_malloc)(VG_AR_CORE, "libcproc.erves.4",
VG_(strlen)(VG_(libdir)) + 20);
// Remove Valgrind-specific entries from LD_*.
|