aboutsummaryrefslogtreecommitdiffstats
path: root/man7/string_copying.7
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-11-12 23:11:52 +0100
committerAlejandro Colomar <alx@kernel.org>2023-11-13 01:15:52 +0100
commit36686c0154a7894e8fa6b6b88dff2d6e57f03bc6 (patch)
tree2d1b86fc88f88ba7283360f51301a21530bdc67a /man7/string_copying.7
parent06930220d3459a5eba0cd5ef12de009f4cd184dd (diff)
downloadman-pages-36686c0154a7894e8fa6b6b88dff2d6e57f03bc6.tar.gz
string_copying.7: Recommend failing instead of truncating
Especially for validating input, code should fail, not truncate. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man7/string_copying.7')
-rw-r--r--man7/string_copying.75
1 files changed, 4 insertions, 1 deletions
diff --git a/man7/string_copying.7 b/man7/string_copying.7
index c8ad15c556..5b3d7768a7 100644
--- a/man7/string_copying.7
+++ b/man7/string_copying.7
@@ -218,9 +218,12 @@ Keeping the code simple
helps these overflow-detection features be more precise.
.P
When validating user input,
+code should normally not truncate,
+but instead fail and prevent the copy at all.
+.P
+In some cases,
however,
it makes sense to truncate.
-Remember to check the return value of such function calls.
.P
Functions that truncate:
.IP \[bu] 3