From: Alexander Monakov Date: Sun, 6 Mar 2016 17:22:38 +0000 (+0300) Subject: env: avoid leaving dangling pointers in __env_map X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=9543656cc32fda48fc463f332ee20e91eed2b768;p=musl 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; } } }