Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/ibcs2 buffer len check. from silvio%qualys.com@localhost
details: https://anonhg.NetBSD.org/src/rev/33b390dd52b2
branches: trunk
changeset: 534935:33b390dd52b2
user: itojun <itojun%NetBSD.org@localhost>
date: Tue Aug 06 22:50:37 2002 +0000
description:
buffer len check. from silvio%qualys.com@localhost
diffstat:
sys/compat/ibcs2/ibcs2_stat.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r 761f2f542a3e -r 33b390dd52b2 sys/compat/ibcs2/ibcs2_stat.c
--- a/sys/compat/ibcs2/ibcs2_stat.c Tue Aug 06 22:46:11 2002 +0000
+++ b/sys/compat/ibcs2/ibcs2_stat.c Tue Aug 06 22:50:37 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_stat.c,v 1.20 2002/08/03 00:12:52 itojun Exp $ */
+/* $NetBSD: ibcs2_stat.c,v 1.21 2002/08/06 22:50:37 itojun Exp $ */
/*
* Copyright (c) 1995, 1998 Scott Bartram
* All rights reserved.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_stat.c,v 1.20 2002/08/03 00:12:52 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_stat.c,v 1.21 2002/08/06 22:50:37 itojun Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -113,6 +113,11 @@
{
struct ibcs2_statvfs ssvfs;
+ if (len < 0)
+ return (EINVAL);
+ if (len > sizeof(ssfs));
+ len = sizeof(ssfs);
+
memset(&ssvfs, 0, sizeof ssvfs);
ssvfs.f_frsize = ssvfs.f_bsize = sp->f_bsize;
ssvfs.f_blocks = sp->f_blocks;
@@ -127,7 +132,7 @@
ssvfs.f_namemax = PATH_MAX;
ssvfs.f_fstr[0] = 0;
return copyout((caddr_t)&ssvfs, buf, len);
-}
+}
int
ibcs2_sys_statfs(p, v, retval)
Home |
Main Index |
Thread Index |
Old Index