summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-04-21 08:56:25 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-04-21 08:56:25 +0000
commitc40b8e93ace00393bc6436f6c9f0f287d0a26d0a (patch)
treee9fa12423988986c243e80f804b267f0be9350b0
parentcaa58cf3d6e11a3acd00296287334a4105c87072 (diff)
handle return value of snprintf correctly
ok deraadt@
-rw-r--r--sys/netinet/ip_ipsp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index c2167421c3d..98c3a7b3575 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.160 2004/11/19 10:11:52 hshoexer Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.161 2005/04/21 08:56:24 hshoexer Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
@@ -1175,6 +1175,8 @@ ipsp_kern(int off, char **bufp, int len)
l = snprintf(buffer, sizeof buffer,
"Hashmask: %d, policy entries: %d\n",
tdb_hashmask, ipsec_in_use);
+ if (l < 0 || l >= sizeof buffer)
+ return 0;
return l;
}