Subject: Re: ed segfault
To: Jachym Holecek <email@example.com>
From: David Laight <firstname.lastname@example.org>
Date: 06/09/2006 22:04:35
On Fri, Jun 09, 2006 at 09:56:25PM +0200, Jachym Holecek wrote:
> # email@example.com 2006-06-09:
> > ed sefaults with a large string due to strcpy() below is a possible fix.
> FWIW the below should be s/MAXPATHLEN - 1/MAXPATHLEN + 1/g, since
> old_filename is defined as "char old_filename[MAXPATHLEN + 1]" and
> strlcpy() should include the terminating NUL in size.
Using 'sizeof (old_filename)' is likely to be better.
OTOH just truncating the string brings in it's own bugs....
David Laight: firstname.lastname@example.org