public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] manual: document snprintf truncation better
@ 2023-04-08 20:54 Paul Eggert
0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2023-04-08 20:54 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f173e27272e6e37cab016f9ef3f90d3e1189329f
commit f173e27272e6e37cab016f9ef3f90d3e1189329f
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat Apr 8 13:51:26 2023 -0700
manual: document snprintf truncation better
Diff:
---
manual/stdio.texi | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/manual/stdio.texi b/manual/stdio.texi
index c502a21036..3820a24f3e 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -2439,7 +2439,10 @@ If @var{size} is zero, nothing, not even the null byte, shall be written and
The return value is the number of characters which would be generated
for the given input, excluding the trailing null. If this value is
greater than or equal to @var{size}, not all characters from the result have
-been stored in @var{s}. You should try again with a bigger output
+been stored in @var{s}. If this happens, you should be wary of using
+the truncated result as that could lead to security, encoding, or
+other bugs in your program (@pxref{Truncating Strings}).
+Instead, you should try again with a bigger output
string. Here is an example of doing this:
@smallexample
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-08 20:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-08 20:54 [glibc] manual: document snprintf truncation better Paul Eggert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).