bug-bash
[Top][All Lists]
Advanced

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

Re: String corruption using \W in prompt


From: DennisW
Subject: Re: String corruption using \W in prompt
Date: Wed, 08 Dec 2010 15:48:36 -0000
User-agent: G2/1.0

On May 27, 8:44 am, Stéphane Jourdois <address@hidden> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include
> -I../bash/lib   -g -O2 -Wall
> uname output: Linux topaze.kwi.fr 2.6.34-2010-05-26-wl-59453-g97ef193
> #52 SMP PREEMPT Wed May 26 10:06:42 CEST 2010 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 4.1
> Patch Level: 5
> Release Status: release
>
> Description:
>         String corruption caused by strcpy on overlapping strings.
>
>         From parse.y, lines 5153-5155 :
>         -----
>                         t = strrchr (t_string, '/');
>                         if (t)
>                           strcpy (t_string, t + 1);
>         -----
>
> Repeat-By:
>         Use \W in PS1, cd to /something :
>         -----
>         address@hidden:~ $ export PS1='\W '
>         ~ cd /root/
>         rott
>         -----
>
> Fix:
> --- parse.y     2010-05-27 15:16:15.623495000 +0200
> +++ parse.y.smj 2010-05-27 15:16:30.364495000 +0200
> @@ -5152,7 +5152,7 @@
>                       {
>                         t = strrchr (t_string, '/');
>                         if (t)
> -                         strcpy (t_string, t + 1);
> +                         memmove (t_string, t + 1, sizeof(t));
>                       }
>                   }
>  #undef ROOT_PATH
>
> Thanks,
> Stéphane (kwisatz) Jourdois.

Can't reproduce in 4.1.0(1)-release.

reply via email to

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