From a7f11948344e03745cfc3b52a9089b770966798e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 31 Dec 2012 18:09:00 +0200 Subject: [PATCH] Fix a bug with time zones on MS-Windows. src/w32.c (unsetenv): Set up the string passed to _putenv correctly. See http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00863.html for the bug this caused. --- src/ChangeLog | 7 +++++++ src/w32.c | 1 + 2 files changed, 8 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 483930a648..e5d663b746 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-12-31 Eli Zaretskii + + * w32.c (unsetenv): Set up the string passed to _putenv + correctly. See + http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00863.html + for the bug this caused. + 2012-12-30 Paul Eggert * coding.c (Qmac): Now static. diff --git a/src/w32.c b/src/w32.c index c9adece652..5e2080139e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1784,6 +1784,7 @@ unsetenv (const char *name) /* It is safe to use 'alloca' with 32K size, since the stack is at least 2MB, and we set it to 8MB in the link command line. */ var = alloca (name_len + 2); + strncpy (var, name, name_len); var[name_len++] = '='; var[name_len] = '\0'; return _putenv (var); -- 2.20.1