[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in getcwd implementation in lib/sh/getcwd.c
From: |
Hugh Sasse |
Subject: |
Re: Bug in getcwd implementation in lib/sh/getcwd.c |
Date: |
Wed, 10 Oct 2007 17:09:41 +0100 (WEST) |
On Tue, 9 Oct 2007, Ian Campbell wrote:
> Fix:
>
> The fix is really to pre-seed config.cache so that it knows that the uclibc
> version of getcwd() does the right thing but the fix for the problem in
> lib/sh/getcwd.c is the patch below from my colleague Christian Limpach.
>
> Index: bash-3.2/lib/sh/getcwd.c
> ===================================================================
> --- bash-3.2.orig/lib/sh/getcwd.c 2007-10-09 09:53:38.000000000 +0100
> +++ bash-3.2/lib/sh/getcwd.c 2007-10-09 09:53:54.000000000 +0100
> @@ -251,19 +251,21 @@
[....]
> + buf = (char *) malloc (size);
> + if (buf == NULL)
> + goto lose2;
> + }
> (void) memcpy((PTR_T) buf, (PTR_T) pathp, len);
> }
As I've been re-examining "The Practice of Programming" (Kernighan and Pike)
I'd like to ask: is there a reason why you wouldn't replace memcpy
with memmove, so if these ever overlap it still works?
Hugh