summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2021-04-01 14:27:47 +0000
committerderaadt <deraadt@openbsd.org>2021-04-01 14:27:47 +0000
commit4af6ccb13c0b15884de7ae705671083a7b06d335 (patch)
treed259176661eb336666c0b19f895e16b6f34e16d8
parentAlso immediately accept the *first* OFFER if it matches the requested address, (diff)
downloadwireguard-openbsd-4af6ccb13c0b15884de7ae705671083a7b06d335.tar.xz
wireguard-openbsd-4af6ccb13c0b15884de7ae705671083a7b06d335.zip
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