summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-04-01 14:27:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-04-01 14:27:48 +0000
commit58a55f4dd0baa2c277509867e44d742d7e7e91c5 (patch)
tree5ebeb34bc3af1f5188ecd43aef7dd9356ff6297f
parent977da75ea7294570e79d156d073fdf45dcff150a (diff)
For the snprintf range check demo, add a (size_t) cast in the right place
which will satisfy the toughest compiler options
-rw-r--r--lib/libc/stdio/printf.36
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index 7c0759b7aad..f83b9030fc0 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.3,v 1.89 2020/09/13 12:58:08 tb Exp $
+.\" $OpenBSD: printf.3,v 1.90 2021/04/01 14:27:47 deraadt Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: September 13 2020 $
+.Dd $Mdocdate: April 1 2021 $
.Dt PRINTF 3
.Os
.Sh NAME
@@ -1019,7 +1019,7 @@ for later interpolation by
Be sure to use the proper secure idiom:
.Bd -literal -offset indent
int ret = snprintf(buffer, sizeof(buffer), "%s", string);
-if (ret < 0 || ret >= sizeof(buffer))
+if (ret < 0 || (size_t)ret >= sizeof(buffer))
goto toolong;
.Ed
.Pp