summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravsm <avsm@openbsd.org>2003-11-23 17:14:21 +0000
committeravsm <avsm@openbsd.org>2003-11-23 17:14:21 +0000
commit9d87a38e30538b2ac040230d0c97715d9c4bfc34 (patch)
tree4edba8bf75c8f8822a69cf456071bf722dde389e
parentallow underscore in usernames, from Niels/NetBSD (diff)
downloadwireguard-openbsd-9d87a38e30538b2ac040230d0c97715d9c4bfc34.tar.xz
wireguard-openbsd-9d87a38e30538b2ac040230d0c97715d9c4bfc34.zip
check for too-small length in stream debug code
discussed with grange@ tedu@
-rw-r--r--sys/compat/svr4/svr4_stream.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c
index 48dbf16797c..c79643ec1d9 100644
--- a/sys/compat/svr4/svr4_stream.c
+++ b/sys/compat/svr4/svr4_stream.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_stream.c,v 1.17 2002/03/14 01:26:51 millert Exp $ */
+/* $OpenBSD: svr4_stream.c,v 1.18 2003/11/23 17:14:21 avsm Exp $ */
/* $NetBSD: svr4_stream.c,v 1.19 1996/12/22 23:00:03 fvdl Exp $ */
/*
@@ -153,6 +153,9 @@ show_ioc(str, ioc)
if (len > 1024)
len = 1024;
+ if (len <= 0)
+ return 0;
+
ptr = (u_char *) malloc(len, M_TEMP, M_WAITOK);
uprintf("%s cmd = %ld, timeout = %d, len = %d, buf = %p { ",
str, ioc->cmd, ioc->timeout, ioc->len, ioc->buf);