mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
* malloc/arena.c (ptmalloc_init): Don't call next_env_entry if
_environ is NULL.
This commit is contained in:
parent
e48cf6786b
commit
08e49216e8
@ -1,3 +1,8 @@
|
|||||||
|
2002-12-27 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* malloc/arena.c (ptmalloc_init): Don't call next_env_entry if
|
||||||
|
_environ is NULL.
|
||||||
|
|
||||||
2002-12-27 Andreas Schwab <schwab@suse.de>
|
2002-12-27 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* Makerules ($(common-objpfx)%.make): Filter through
|
* Makerules ($(common-objpfx)%.make): Filter through
|
||||||
|
@ -436,49 +436,50 @@ ptmalloc_init __MALLOC_P((void))
|
|||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
secure = __libc_enable_secure;
|
secure = __libc_enable_secure;
|
||||||
s = NULL;
|
s = NULL;
|
||||||
{
|
if (__builtin_expect (_environ != NULL, 1))
|
||||||
char **runp = _environ;
|
{
|
||||||
char *envline;
|
char **runp = _environ;
|
||||||
|
char *envline;
|
||||||
|
|
||||||
while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL,
|
while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL,
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
size_t len = strcspn (envline, "=");
|
size_t len = strcspn (envline, "=");
|
||||||
|
|
||||||
if (envline[len] != '=')
|
if (envline[len] != '=')
|
||||||
/* This is a "MALLOC_" variable at the end of the string
|
/* This is a "MALLOC_" variable at the end of the string
|
||||||
without a '=' character. Ignore it since otherwise we
|
without a '=' character. Ignore it since otherwise we
|
||||||
will access invalid memory below. */
|
will access invalid memory below. */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (len)
|
switch (len)
|
||||||
{
|
{
|
||||||
case 6:
|
case 6:
|
||||||
if (memcmp (envline, "CHECK_", 6) == 0)
|
if (memcmp (envline, "CHECK_", 6) == 0)
|
||||||
s = &envline[7];
|
s = &envline[7];
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0)
|
if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0)
|
||||||
mALLOPt(M_TOP_PAD, atoi(&envline[9]));
|
mALLOPt(M_TOP_PAD, atoi(&envline[9]));
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0)
|
if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0)
|
||||||
mALLOPt(M_MMAP_MAX, atoi(&envline[10]));
|
mALLOPt(M_MMAP_MAX, atoi(&envline[10]));
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
if (! secure)
|
if (! secure)
|
||||||
{
|
{
|
||||||
if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0)
|
if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0)
|
||||||
mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16]));
|
mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16]));
|
||||||
else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0)
|
else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0)
|
||||||
mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16]));
|
mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (! secure)
|
if (! secure)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user