Module Name:    src
Committed By:   pooka
Date:           Sat Dec  4 17:39:51 UTC 2010

Modified Files:
        src/sys/dev: rnd.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/rnd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/rnd.c
diff -u src/sys/dev/rnd.c:1.78 src/sys/dev/rnd.c:1.79
--- src/sys/dev/rnd.c:1.78	Tue Jul 27 14:34:33 2010
+++ src/sys/dev/rnd.c	Sat Dec  4 17:39:50 2010
@@ -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);

Reply via email to