Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Don't allow "goes to 11^H^Hhyperspace" len field for...



details:   https://anonhg.NetBSD.org/src/rev/91f75a8ccb51
branches:  trunk
changeset: 759263:91f75a8ccb51
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Dec 04 17:39:50 2010 +0000

description:
Don't allow "goes to 11^H^Hhyperspace" len field for RNDADDATA.

diffstat:

 sys/dev/rnd.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 32308bd349f2 -r 91f75a8ccb51 sys/dev/rnd.c
--- a/sys/dev/rnd.c     Sat Dec 04 17:38:42 2010 +0000
+++ b/sys/dev/rnd.c     Sat Dec 04 17:39:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rnd.c,v 1.78 2010/07/27 14:34:33 jakllsch Exp $        */
+/*     $NetBSD: rnd.c,v 1.79 2010/12/04 17:39:50 pooka Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.78 2010/07/27 14:34:33 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.79 2010/12/04 17:39:50 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -662,6 +662,9 @@
        case RNDADDDATA:
                rnddata = (rnddata_t *)addr;
 
+               if (rnddata->len > sizeof(rnddata->data))
+                       return E2BIG;
+
                mutex_enter(&rndpool_mtx);
                rndpool_add_data(&rnd_pool, rnddata->data, rnddata->len,
                    rnddata->entropy);



Home | Main Index | Thread Index | Old Index