[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils readlink buffer overflow on GNU/Hurd, plus speedup
From: |
Jim Meyering |
Subject: |
Re: coreutils readlink buffer overflow on GNU/Hurd, plus speedup |
Date: |
Tue, 01 Jun 2004 15:31:27 +0200 |
Paul Eggert <address@hidden> wrote:
> While auditing coreutils I noticed a potential buffer overrun in
> copy.c on hosts like GNU/Hurd where symbolic links have potentially
> unlimited length. Here's a patch. As a nice side effect, this patch
> improves the performance of programs on 'ls' on more-ordinary hosts
> when they are given long symlinks, as it causes readlink to be invoked
> once, rather than twice, when the symlink is long.
>
> 2004-05-25 Paul Eggert <address@hidden>
>
> Improve the efficiency (and in one case, correctness) of code
> that reads symlinks.
>
> * lib/xreadlink.c: Include xreadlink.h first, to catch .h file
> dependency problems.
> (xreadlink): Accept new arg SIZE, for efficiency.
> All decls and uses changed.
> * lib/xreadlink.h: Include <stddef.h>, for size_t.
> * src/copy.c (copy_internal): Don't use alloca, as it can mess up
> royally if the link length is long (e.g., GNU/Hurd). Use
> xreadlink instead, it's safer. Don't bother to read the link if
> it's the wrong size. Add a FIXME because this area is a bit murky
> and undocumented.
Thanks!
Applied.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: coreutils readlink buffer overflow on GNU/Hurd, plus speedup,
Jim Meyering <=