Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Error out of ptcread() if the uio length supplied i...



details:   https://anonhg.NetBSD.org/src/rev/d488504f35ae
branches:  trunk
changeset: 748139:d488504f35ae
user:      dsl <dsl%NetBSD.org@localhost>
date:      Wed Oct 14 19:25:39 2009 +0000

description:
Error out of ptcread() if the uio length supplied is zero before the code
has a chance to panic in ureadc().

diffstat:

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

diffs (28 lines):

diff -r 2bbc2dc675f2 -r d488504f35ae sys/kern/tty_pty.c
--- a/sys/kern/tty_pty.c        Wed Oct 14 19:14:39 2009 +0000
+++ b/sys/kern/tty_pty.c        Wed Oct 14 19:25:39 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty_pty.c,v 1.118 2009/10/11 08:08:32 dsl Exp $        */
+/*     $NetBSD: tty_pty.c,v 1.119 2009/10/14 19:25:39 dsl Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.118 2009/10/11 08:08:32 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.119 2009/10/14 19:25:39 dsl Exp $");
 
 #include "opt_ptm.h"
 
@@ -586,6 +586,9 @@
        int error = 0, cc;
        int c;
 
+       if (uio->uio_resid <= 0)
+               return EINVAL;
+
        /*
         * We want to block until the slave
         * is open, and there's something to read;



Home | Main Index | Thread Index | Old Index