summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/printf.3
diff options
context:
space:
mode:
authorJared Yanovich <jaredy@cvs.openbsd.org>2005-07-26 03:30:26 +0000
committerJared Yanovich <jaredy@cvs.openbsd.org>2005-07-26 03:30:26 +0000
commit56efb7874536df9516efc1b361f89bd7c6ae87ee (patch)
tree343b9a8fce5816c9a3d7c7161079c3882ec756b9 /lib/libc/stdio/printf.3
parent03ed4d1150e07efa307ccba0948c2a9ba9452e27 (diff)
- typos, punctuation, spacing, macro, layout, etc. fixes
- avoid first person ok jmc
Diffstat (limited to 'lib/libc/stdio/printf.3')
-rw-r--r--lib/libc/stdio/printf.317
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index f138476201c..0678581bff4 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.3,v 1.48 2005/07/26 03:23:14 jaredy Exp $
+.\" $OpenBSD: printf.3,v 1.49 2005/07/26 03:30:25 jaredy Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -653,7 +653,7 @@ to five decimal places:
fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));
.Ed
.Pp
-To allocate a 128 byte string and print into it:
+To allocate a 128-byte string and print into it:
.Bd -literal -offset indent
#include <stdarg.h>
#include <stdio.h>
@@ -749,9 +749,9 @@ interface is not portable.
It is important never to pass a string with user-supplied data as a
format without using
.Ql %s .
-An attacker can put format specifiers in the string to mangle your stack,
+An attacker can put format specifiers in the string to mangle the stack,
leading to a possible security hole.
-This holds true even if you have built the string
+This holds true even if the string has been built
.Dq by hand
using a function like
.Fn snprintf ,
@@ -764,8 +764,11 @@ Be sure to use the proper secure idiom:
snprintf(buffer, sizeof(buffer), "%s", string);
.Ed
.Pp
-There is no way for printf to know the size of each argument passed.
-If you use positional arguments you must ensure that all parameters, up to the
+There is no way for
+.Fn printf
+to know the size of each argument passed.
+If positional arguments are used, care must be taken to ensure that all
+parameters, up to the
last positionally specified parameter, are used in the format string.
This allows for the format string to be parsed for this information.
-Failure to do this will mean your code is non-portable and liable to fail.
+Failure to do this will mean the code is non-portable and liable to fail.