From: Alexander Monakov Date: Sun, 6 Mar 2016 17:22:38 +0000 (+0300) Subject: env: avoid leaving dangling pointers in __env_map X-Git-Tag: v1.1.15~88 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9543656cc32fda48fc463f332ee20e91eed2b768;p=oweals%2Fmusl.git env: avoid leaving dangling pointers in __env_map This is the minimal fix for __putenv leaving a pointer to freed heap storage in __env_map array, which could later on lead to errors such as double-free. --- diff --git a/src/env/putenv.c b/src/env/putenv.c index 4042869b..71530426 100644 --- a/src/env/putenv.c +++ b/src/env/putenv.c @@ -30,6 +30,7 @@ int __putenv(char *s, int a) } } else { free(__env_map[j]); + __env_map[j] = s; } } }