Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strndup returning an address out of bounds

In article <>,
Jeremy C. Reed <> wrote:
>On Wed, 12 Mar 2008, Christos Zoulas wrote:
>I don't understand.

This function is not visible if some other symbol is defined like
_POSIX_C_SOURCE, or _ANSI_SOURCE, or _XOPEN_SOURCE etc, since only
symbols that are defined by the respective standards are supposed
to be visible.

>The problem was fixed by defining _NETBSD_SOURCE.

Yes. But _NETBSD_SOURCE is defined by default if no other standard
is defined.

>Should the strndup manpage mention that?

It could.

>(The netsurf developer saw by reading our string.h.)

The netsurf developer should not be defining _FOO_SOURCE if he intends
to use symbols outside the scope of _FOO_SOURCE. He should also be compiling
with warnings on so that problems like this become apparent :-)
Look in <sys/featuretest.h>


Home | Main Index | Thread Index | Old Index