This is the mail archive of the
mailing list for the glibc project.
Re: [open-source] Re: Wish for 2002 ...
- From: Henry Spencer <henry at spsystems dot net>
- To: "Martin v. Loewis" <martin at v dot loewis dot de>
- Cc: kaz at ashi dot footprints dot net, libc-alpha at sources dot redhat dot com
- Date: Sun, 13 Jan 2002 21:17:23 -0500 (EST)
- Subject: Re: [open-source] Re: Wish for 2002 ...
(Note, *not* cc'ed to the open-source mailing list -- this has nothing to
do with them. Does mean that I won't see followups unless cc'ed to me.)
On Sun, 13 Jan 2002, Martin v. Loewis wrote:
> After reading the paper, I find that the border cases of overlapping
> strings for strlcat is not specified...
"If it isn't specified, then the behavior is undefined." No specification
is *NO SPECIFICATION*, i.e. user code should never depend on it.
> Furthermore, the exact meaning of the return value *is* troubling. The
> paper did not consider the case that dst is not null-terminated within
As others have already noted, strings are NUL-terminated by definition, so
the behavior is undefined. This doesn't mean that the implementation
can't try to do something sensible. It does mean that there is no promise
of sensible behavior, so user code should never depend on it.
Opinions vary on whether it is kinder to the users, in such a case, to
dump core or to try to do "the right thing". The former makes it more
likely that the user error will be detected, the latter more likely that
the program can stumble on and continue functioning despite an undetected