Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/osf1 Ensure nbytes > 0. Otherwise bad things may ...
details: https://anonhg.NetBSD.org/src/rev/9a3d5ab051ba
branches: trunk
changeset: 331785:9a3d5ab051ba
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Aug 24 12:48:58 2014 +0000
description:
Ensure nbytes > 0. Otherwise bad things may happen.
Compile-tested only.
ok christos@
diffstat:
sys/compat/osf1/osf1_file.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r 55762a574e06 -r 9a3d5ab051ba sys/compat/osf1/osf1_file.c
--- a/sys/compat/osf1/osf1_file.c Sun Aug 24 12:42:03 2014 +0000
+++ b/sys/compat/osf1/osf1_file.c Sun Aug 24 12:48:58 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_file.c,v 1.41 2011/07/22 10:02:08 njoly Exp $ */
+/* $NetBSD: osf1_file.c,v 1.42 2014/08/24 12:48:58 maxv Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.41 2011/07/22 10:02:08 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.42 2014/08/24 12:48:58 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_syscall_debug.h"
@@ -133,7 +133,7 @@
/* {
syscallarg(int) fd;
syscallarg(char *) buf;
- syscallarg(u_int) nbytes;
+ syscallarg(int) nbytes;
syscallarg(long *) basep;
} */
struct dirent *bdp;
@@ -151,6 +151,11 @@
off_t *cookiebuf = NULL, *cookie;
int ncookies, fd;
+ if (SCARG(uap, nbytes) < 0)
+ return EINVAL;
+ if (SCARG(uap, nbytes) == 0)
+ return 0;
+
fd = SCARG(uap, fd);
if ((error = fd_getvnode(fd, &fp)) != 0)
return (error);
Home |
Main Index |
Thread Index |
Old Index