summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-11-23 17:14:22 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-11-23 17:14:22 +0000
commit1a5651b56ffe503dc6769a18bda1e4795e136d85 (patch)
treed16b33c79353c79b5d36b5f6349429c9d73c7d80
parent2e16350be3ee8619393561c3e42ee4fa58d6b385 (diff)
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);