diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-11-21 16:45:51 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-11-21 19:30:48 +0100 |
commit | 3f8d7b04cdf46ee00e62f0c5bf67fc3227a3eb12 (patch) | |
tree | d24677901b88d475c39e9f0eef5a2be8686f8f1b | |
parent | 16c9d44ea72ceb2e0fbbdbf8a0da87f822a61cea (diff) |
strncat.3: Say that if dst isn't a string, the behavior is undefined
Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man3/strncat.3 | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/man3/strncat.3 b/man3/strncat.3 index 9e9c735c8..54e0d7bb3 100644 --- a/man3/strncat.3 +++ b/man3/strncat.3 @@ -21,8 +21,9 @@ This function appends the input character sequence contained in a null-padded fixed-size buffer, into a string at the buffer pointed to by .IR dst . -The programmer is responsible for allocating a destination buffer large enough, -that is, +.I dst +must point to a string contained in a buffer that is large enough, +that is, the buffer size must be at least .IR "strlen(dst) + strnlen(src, ssize) + 1" . .P An implementation of this function might be: @@ -68,7 +69,8 @@ The name of this function is confusing. This function has no relation to .BR strncpy (3). .P -If the destination buffer is not large enough, +If the destination buffer does not already contain a string, +or is not large enough, the behavior is undefined. See .B _FORTIFY_SOURCE |