bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2062: PATH can contain non-expanded variables


From: Juanma Barranquero
Subject: bug#2062: PATH can contain non-expanded variables
Date: Mon, 26 Jan 2009 14:00:15 +0100

Package: emacs,w32
Version: 23.0.60

It is possible for PATH (or other path-like variables, like EMACSPATH
and EMACSLOADPATH) to contain unexpanded variables:

ELISP> exec-path
("c:/emacs/bin" "%MYTEST%" "C:/WINDOWS/system32" "C:/WINDOWS"
"C:/WINDOWS/system32/Wbem" "c:/emacs/trunk/bin")

for example, if the user has set
"HKLM\Microsoft\Windows\CurrentVersion\App Paths\emacs.exe\Path" as a
REG_EXPAND_SZ.

These variables should be expanded, but currently
emacs.c:decode_env_path does not. The following patch fixes it.

Comments?

    Juanma


Index: emacs.c
===================================================================
RCS file: /sources/emacs/emacs/src/emacs.c,v
retrieving revision 1.461
diff -u -2 -r1.461 emacs.c
--- emacs.c     23 Jan 2009 14:53:11 -0000      1.461
+++ emacs.c     26 Jan 2009 12:48:49 -0000
@@ -2467,6 +2467,12 @@
   if (path)
     {
+#ifdef WINDOWSNT
+      DWORD required = ExpandEnvironmentStrings (path, NULL, 0);
+      p = (char *) alloca (required);
+      ExpandEnvironmentStrings (path, p, required);
+#else
       p = alloca (strlen (path) + 1);
       strcpy (p, path);
+#endif
       path = p;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]