Incorrect usage of dirname() in sysdep/unix/main.c causes segfault
Henrique de Moraes Holschuh
hmh at hmh.eng.br
Mon Mar 26 18:08:43 CEST 2012
On Mon, 19 Mar 2012, Ondrej Zajicek wrote:
> On Sun, Mar 18, 2012 at 10:53:32AM -0300, Henrique de Moraes Holschuh wrote:
> > According to POSIX, dirname() is allowed to modify the string passed to
> > it. In fact, according to dirname(3), glibc's will do just that when
> > libgen.h is in use. The manpage even warns you that it will segfault
> > when passed a constant that cannot be modified...
> >
> > Well, I hit that bug and it took a while to track it down.
> > --enable-debug seems to link a different dirname() that is less crappy,
> > so the bug wouldn't show up in debug builds.
> >
> > The attached patch explains it better.
>
> Thanks, merged.
Thank you.
FYI, I have since discobered that this patch fixed another issue: when
multiple "include" statements were processed, relative paths were being
corrupted: each include statement processed would remove one path component
from config_name, thus:
config /etc/binr/bird.conf
include "foo"
include "bar"
include "baz"
would try to read: /etc/bird/bird.conf, /etc/bird/foo, /etc/bar, and finally
/baz.
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
More information about the Bird-users
mailing list