Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Check for (and deny) negative values passed to FIOG...



details:   https://anonhg.NetBSD.org/src/rev/7873a4ff72c6
branches:  trunk
changeset: 542543:7873a4ff72c6
user:      atatat <atatat%NetBSD.org@localhost>
date:      Sat Feb 01 07:23:56 2003 +0000

description:
Check for (and deny) negative values passed to FIOGETBMAP.

diffstat:

 sys/kern/vfs_vnops.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 7aeab556dddb -r 7873a4ff72c6 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c      Sat Feb 01 06:50:42 2003 +0000
+++ b/sys/kern/vfs_vnops.c      Sat Feb 01 07:23:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnops.c,v 1.61 2003/01/24 21:55:17 fvdl Exp $      */
+/*     $NetBSD: vfs_vnops.c,v 1.62 2003/02/01 07:23:56 atatat Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.61 2003/01/24 21:55:17 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.62 2003/02/01 07:23:56 atatat Exp $");
 
 #include "fs_union.h"
 
@@ -684,12 +684,16 @@
                if (com == FIOGETBMAP) {
                        daddr_t *block;
 
+                       if (*(daddr_t *)data < 0)
+                               return (EINVAL);
                        block = (daddr_t *)data;
                        return (VOP_BMAP(vp, *block, NULL, block, NULL));
                }
                if (com == OFIOGETBMAP) {
                        daddr_t ibn, obn;
 
+                       if (*(int32_t *)data < 0)
+                               return (EINVAL);
                        ibn = (daddr_t)*(int32_t *)data;
                        error = VOP_BMAP(vp, ibn, NULL, &obn, NULL);
                        *(int32_t *)data = (int32_t)obn;



Home | Main Index | Thread Index | Old Index