From e2f7bd0469c8751d9f37d493d395180a61286e94 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 30 Mar 2018 12:35:23 +0100 Subject: ash: copy environment variables when importing them Clearing the environment on Microsoft Windows results in pointers used for shell variables becoming invalid. Take copies when the environment is imported. This only affects NOFORK applets invoked by tryexec, but the number of NOFORK applets has increased considerably in recent years. --- shell/ash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/ash.c b/shell/ash.c index 586925835..2d51b48f9 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -14502,7 +14502,11 @@ init(void) * os.execv("ash", [ 'ash', '-c', 'env | grep test-test' ]) # breaks this */ if (strchr(*envp, '=')) { +#if !ENABLE_PLATFORM_MINGW32 setvareq(*envp, VEXPORT|VTEXTFIXED); +#else + setvareq(*envp, VEXPORT); +#endif } } -- cgit v1.2.3-55-g6feb