Module Name: src Committed By: martin Date: Fri Sep 20 11:22:29 UTC 2024
Modified Files: src/lib/libc/string [netbsd-10]: Makefile.inc strcpy.3 strlcpy.3 Added Files: src/lib/libc/string [netbsd-10]: strncpy.3 Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.85.6.1 src/lib/libc/string/Makefile.inc cvs rdiff -u -r1.23 -r1.23.26.1 src/lib/libc/string/strcpy.3 cvs rdiff -u -r1.14 -r1.14.2.1 src/lib/libc/string/strlcpy.3 cvs rdiff -u -r0 -r1.16.4.2 src/lib/libc/string/strncpy.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.