Home | History | Annotate | Download | only in string
History log of /src/lib/libc/string/strlcpy.3
RevisionDateAuthorComments
 1.25  02-Apr-2025  gutteridge strlcpy.3: bump date to reflect recent significant changes
 1.24  30-Mar-2025  riastradh strlcpy(3): Pick some nits in the prose.
 1.23  30-Mar-2025  riastradh strlcpy(3): Another attempt at reworking the description for clarity.

These functions have extremely sharp edges that are apparently still
inadequately documented. Put the full behaviour of both functions
more clearly up front, emphasize that src MUST be NUL-terminated up
front, and add another WARNING for another sharp edge that wasn't
made clear enough.
 1.22  01-Nov-2024  nia libc: Expose some newly-standard C functions in POSIX.1-2024 mode
 1.21  11-Aug-2023  riastradh branches: 1.21.2;
strlcpy(3): Tweak markup.
 1.20  11-Aug-2023  riastradh strlcpy(3), strncpy(3): Omit needless (void) casts in examples.

The return values are not critical.
 1.19  11-Aug-2023  riastradh strcpy(3), strlcpy(3), strncpy(3): Just say `byte', not `character'.
 1.18  11-Aug-2023  riastradh strlcpy(3): Nix stray space between `NUL' and `-terminating'.
 1.17  11-Aug-2023  uwe strlcpy(3): don't use \*[Ge] for >= - it's wrong for source code

In the PostScript output it produces the single mathematical "greater
or equal" symbol, not the ">=".
 1.16  11-Aug-2023  riastradh strcpy(3), strlcpy(3), strncpy(3): Use `.Tn NUL' for the zero byte.

Let's be consistent within these man pages. (If someone else really
likes the unpronounceable `.Ql \e0' better, that's fine, you can go
through and systematically change all the man pages to use that after
we're done clarifying strcpy(3), strncpy(3), and strlcpy(3).)
 1.15  11-Aug-2023  riastradh strlcpy(3): Rework man page to clarify relation to strncpy(3).

Add caveats explaining when strlcpy(3) and strlcat(3) are dangerously
inadequate or inappropriate.

XXX pullup-10
XXX pullup-9
XXX pullup-8
 1.14  28-Aug-2022  hgutch branches: 1.14.2;
Change back various occurrences of \*[Le], \*[Ge] (less/greater equal)
and \*(ua (upwards arrow) to literal "<=", ">=" and "^" whenever
appropriate (e.g., in code examples).
 1.13  14-Apr-2010  wiz Join URL.
 1.12  14-Apr-2010  jruoho Add the USENIX paper of Miller and de Raadt to SEE ALSO.
 1.11  26-Jun-2003  wiz There is no FreeBSD-3.3.0, only FreeBSD-3.3.
 1.10  16-Apr-2003  wiz Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
 1.9  07-Feb-2002  ross Generate <>& symbolically.
 1.8  16-Nov-2001  itojun sync with latest openbsd one. this one describes corner case of strlcat better
 1.7  16-Sep-2001  wiz Whitespace fixes and sort SEE ALSO.
 1.6  02-Mar-2001  cgd branches: 1.6.2;
update the date; pointed out by mycroft
 1.5  02-Mar-2001  cgd don't forget the LIBRARY section
 1.4  25-Jan-2001  jdolecek remove bogus comment from EXAMPLE section
Add HISTORY section, mentioning strlcpy()/strlcat() first appeared
in OpenBSD 2.4 and when this came to NetBSD and FreeBSD
 1.3  24-Nov-2000  itojun sync with latest openbsd.
comment in strlcat(3) was wrong about return value.
 1.2  08-Sep-1999  lukem branches: 1.2.10;
add netbsd rcsid's
update for knf (return value on separate line to function name...)
check dst and src aren't null pointers before trying to use them
enable strlcat/strlcpy
 1.1  08-Sep-1999  lukem branches: 1.1.1;
Initial revision
 1.1.1.1  08-Sep-1999  lukem strlcpy() and strlcat() by Todd Miller <Todd.Miller@courtesan.com>, via openbsd
 1.2.10.2  05-Jul-2000  he Pull up revisions 1.1-1.2 (new, requested by he):
Add strlcpy() and strlcat() to libc.
 1.2.10.1  08-Sep-1999  he file strlcpy.3 was added on branch netbsd-1-4 on 2000-07-05 21:00:52 +0000
 1.6.2.4  22-Mar-2002  nathanw Catch up to -current.
 1.6.2.3  08-Mar-2002  nathanw Catch up to -current.
 1.6.2.2  28-Jan-2002  nathanw Catch up to -current.
 1.6.2.1  08-Oct-2001  nathanw Catch up to -current.
 1.14.2.1  20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #891):

lib/libc/string/strncpy.3: revision 1.10
lib/libc/string/strncpy.3: revision 1.11
lib/libc/string/strncpy.3: revision 1.12
lib/libc/string/strncpy.3: revision 1.13
lib/libc/string/strncpy.3: revision 1.14
lib/libc/string/strncpy.3: revision 1.15
lib/libc/string/strlcpy.3: revision 1.20
lib/libc/string/strncpy.3: revision 1.16
lib/libc/string/strncpy.3: revision 1.1
lib/libc/string/strlcpy.3: revision 1.21
lib/libc/string/strncpy.3: revision 1.2
lib/libc/string/strncpy.3: revision 1.3
lib/libc/string/strncpy.3: revision 1.4
lib/libc/string/strncpy.3: revision 1.5
lib/libc/string/strncpy.3: revision 1.6
lib/libc/string/Makefile.inc: revision 1.88
lib/libc/string/strncpy.3: revision 1.7
lib/libc/string/Makefile.inc: revision 1.89
lib/libc/string/strncpy.3: revision 1.8
lib/libc/string/strncpy.3: revision 1.9
lib/libc/string/strcpy.3: revision 1.24
lib/libc/string/strcpy.3: revision 1.25
lib/libc/string/strcpy.3: revision 1.26
lib/libc/string/strcpy.3: revision 1.27
lib/libc/string/strlcpy.3: revision 1.15
lib/libc/string/strlcpy.3: revision 1.16
lib/libc/string/strlcpy.3: revision 1.17
lib/libc/string/strlcpy.3: revision 1.18
lib/libc/string/strlcpy.3: revision 1.19

strlcpy(3): Rework man page to clarify relation to strncpy(3).

Add caveats explaining when strlcpy(3) and strlcat(3) are dangerously
inadequate or inappropriate.

strncpy(3), stpncpy(3): Split man page out of strcpy(3), stpcpy(3).

These are for substantively different purposes (fixed-width fields
with optional NUL padding vs NUL-terminated strings), so they don't
belong together.

Be more specific about the security issues.

strncpy(3): Qualify example of strlcpy(3) with a major caveat.

strncpy(3): Slightly more consistency about NUL vs '\0' in the text.

Install strncpy.3 to fix build
strncpy(3): use .Sm off/on around a fancy expression to avoid lots of Ns
strncpy(3): markup tweaks

NUL is a character name, not a defined name, use .Tn
.Ns has implicit .No effect

Use \*q for ASCII quotes (.Dq uses fancy typographical ones)
strcpy(3), strlcpy(3), strncpy(3): Use `.Tn NUL' for the zero byte.

Let's be consistent within these man pages. (If someone else really
likes the unpronounceable `.Ql \e0' better, that's fine, you can go
through and systematically change all the man pages to use that after
we're done clarifying strcpy(3), strncpy(3), and strlcpy(3).)

strncpy(3): Note strcpy(3) man page revision this forked from.

strncpy(3): Rework the example in an attempt to improve exposition.

strcpy(3): Note that strlcpy(3) is a safer replacement for strcpy(3).

Suggest snprintf("%s") as a more portable alternative too.

Note that both strlcpy and snprintf still require the input to be
NUL-terminated.

strlcpy(3): don't use \*[Ge] for >= - it's wrong for source code

In the PostScript output it produces the single mathematical "greater
or equal" symbol, not the ">=".

strlcpy(3): Nix stray space between `NUL' and `-terminating'.

strncpy(3): Take another whack at clarifying this.

Emphasize the fixed-buffer nature of it, and that NUL-termination is
neither required on input nor guaranteed on output.

strncpy(3): Fix typo -- stpncpy, not stpcpy which is different.

strncpy(3): Reword to make sentence structure parallel.

strncpy(3): Tiny wording tweak.

strcpy(3), strlcpy(3), strncpy(3): Just say `byte', not `character'.

strlcpy(3), strncpy(3): Omit needless (void) casts in examples.
The return values are not critical.

strlcpy(3): Tweak markup.

strncpy(3): Fix column sizing.

strncpy(3): More on how strlcpy is not a safe strncpy replacement.
 1.21.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed