This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [open-source] Re: Wish for 2002 ...
- From: "Martin v. Loewis" <martin at v dot loewis dot de>
- To: henry at spsystems dot net
- Cc: kaz at ashi dot footprints dot net, libc-alpha at sources dot redhat dot com, open-source at csl dot sri dot com
- Date: Sun, 13 Jan 2002 10:48:29 +0100
- Subject: Re: [open-source] Re: Wish for 2002 ...
- References: <Pine.BSI.3.91.1020110181437.9400C-100000@spsystems.net>
> It is lamentable that there has been some divergence, but that doesn't
> mean one has to freeze, paralyzed with indecision, and do nothing. The
> original Usenix paper, which in the absence of formal standardization is
> the closest thing we have to a standard, specified the semantics in some
> detail; is there a question it does not answer?
After reading the paper, I find that the border cases of overlapping
strings for strlcat is not specified. I can see two scenarios:
a) src is a substring of dst, such as
strlcat(msg, msg, buffersize(msg));
b) src is in the free space after dst, such as
strlcat(msg, msg+strlen(msg)+5, buffersize(msg));
Furthermore, the exact meaning of the return value *is* troubling. The
paper did not consider the case that dst is not null-terminated within
siz; the current BSD implementation does (but changes the meaning of
the return value). The case that src is not null-terminated is not
considered at all.
Regards,
Martin