Module Name:    src
Committed By:   dsl
Date:           Wed Oct 14 19:25:39 UTC 2009

Modified Files:
        src/sys/kern: tty_pty.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/kern/tty_pty.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/kern/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.118 src/sys/kern/tty_pty.c:1.119
--- src/sys/kern/tty_pty.c:1.118	Sun Oct 11 08:08:32 2009
+++ src/sys/kern/tty_pty.c	Wed Oct 14 19:25:39 2009
@@ -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;

Reply via email to