GNU bug report logs - #2062
PATH can contain non-expanded variables

Previous Next

Packages: w32, emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Mon, 26 Jan 2009 13:10:04 UTC

Severity: normal

Tags: notabug

Found in version 23.0.60

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jason Rumney <jasonr <at> f2s.com>
To: Juanma Barranquero <lekktu <at> gmail.com>, 2062 <at> debbugs.gnu.org
Cc: Emacs Bug Tracker <submit <at> debbugs.gnu.org>
Subject: bug#2062: PATH can contain non-expanded variables
Date: Tue, 27 Jan 2009 09:56:59 +0800
Juanma Barranquero wrote:
> 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;
>   

The right place to do this expansion is where the variable is read from 
the registry, and only when the type is REG_EXPAND_SZ.





This bug report was last modified 16 years and 175 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.