|
From: <sv...@va...> - 2010-06-15 12:49:25
|
Author: tom
Date: 2010-06-15 13:49:07 +0100 (Tue, 15 Jun 2010)
New Revision: 11178
Log:
Avoid reading beyond the end of the environment variable when
using mash_colon_env to remove paths. Should fix #215914.
Modified:
trunk/coregrind/m_libcproc.c
Modified: trunk/coregrind/m_libcproc.c
===================================================================
--- trunk/coregrind/m_libcproc.c 2010-06-15 08:16:00 UTC (rev 11177)
+++ trunk/coregrind/m_libcproc.c 2010-06-15 12:49:07 UTC (rev 11178)
@@ -182,9 +182,13 @@
entry_start = output+1; /* entry starts after ':' */
}
- *output++ = *varp++;
+ if (*varp)
+ *output++ = *varp++;
}
+ /* make sure last entry is nul terminated */
+ *output = '\0';
+
/* match against the last entry */
if (VG_(string_match)(remove_pattern, entry_start)) {
output = entry_start;
|