This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v7] Implement strlcpy, strlcat [BZ #178]
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Alexander Cherepanov <ch3root at openwall dot com>, Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 4 Jan 2016 16:52:30 -0800
- Subject: Re: [PATCH v7] Implement strlcpy, strlcat [BZ #178]
- Authentication-results: sourceware.org; auth=none
- References: <5682DD7E dot 6000301 at redhat dot com> <56839678 dot 8040304 at cs dot ucla dot edu> <568ADC5F dot 5010608 at redhat dot com> <568B0824 dot 6000101 at openwall dot com>
On 01/04/2016 04:02 PM, Alexander Cherepanov wrote:
The description of snprintf in C11 doesn't mention size of the
destination array or talk about any connection between n and s at all,
True, but the POSIX description for snprintf (s, n, ...) has the
additional restriction that n must be the size of the buffer referred to
by s, so POSIX implementations of snprintf can assume that s's size is n
and that the destination array does not overlap any of the sources,
regardless of which parts of the destination are written to.