From d56554f0d693c4c0c63c15f0ae1c437005b16666 Mon Sep 17 00:00:00 2001 From: Lennart Jablonka Date: Fri, 28 Jul 2023 19:22:10 +0000 Subject: string_copying.7: don't grant strl{cpy,cat} magic A function can't check whether a pointer points to the start of a string. What it certainly can do is to keep reading until you either find a null byte or read the secret key that lies adjacent in memory and post it to your favorite mailing list. strlcpy and strlcat behave the exact same way any other function accepting a string behaves: If you don't pass a string, the behavior is undefined. And that, I believe, does not deserve a special mention here, seeing as all the other string functions don't get such a mention either. Link: Signed-off-by: Lennart Jablonka Signed-off-by: Alejandro Colomar --- man7/string_copying.7 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/man7/string_copying.7 b/man7/string_copying.7 index ab9199a68..34031ea02 100644 --- a/man7/string_copying.7 +++ b/man7/string_copying.7 @@ -223,8 +223,7 @@ It only requires to check for truncation once after all chained calls. .BR strlcpy (3bsd) and .BR strlcat (3bsd) -are designed to crash if the input string is invalid -(doesn't contain a terminating null byte). +are similar, but less efficient when chained. .IP \[bu] .BR stpncpy (3) and @@ -410,9 +409,6 @@ isn't large enough to hold the copy, the resulting string is truncated (but it is guaranteed to be null-terminated). They return the length of the total string they tried to create. -These functions force a SIGSEGV if the -.I src -pointer is not a string. .IP .BR stpecpy (3) is a simpler alternative to these functions. -- cgit v1.2.3