[BusyBox] Bug in cp

Erik Andersen andersen at lineo.com
Fri Apr 27 15:49:53 UTC 2001


On Fri Apr 27, 2001 at 09:41:02AM -0600, Matt Kraai wrote:
> On Fri, Apr 27, 2001 at 08:10:56AM -0700, Brian Webb wrote:
> > I had some problems trying to "cp -a" a directory that contained links in
> > it.  Several of the links would have trailing garbage at the end.  It turns
> > out that afterh the call to readlink in libbb/copy_file.c the buffer is not
> > getting terminated correctly.  The patch below seems to fix the problem.
> 
> Thanks.  I've committed your fix.  I'll have to read the manpage
> more carefully next time.

If it is any consolation, I made the exact same mistake in
tar.c.  The fact that readlink(2) doesn't NULL terminate 
bites nearly everyone that uses it at some time or other.

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the busybox mailing list