From 288de794aea9ad381bd57da0286a319aee28f82f Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 5 Dec 1995 02:24:00 +0000 Subject: (pty_io_read, pty_io_write): Validate CRED. --- term/ptyio.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'term/ptyio.c') diff --git a/term/ptyio.c b/term/ptyio.c index 697cd289..782a00f1 100644 --- a/term/ptyio.c +++ b/term/ptyio.c @@ -220,7 +220,11 @@ pty_io_read (struct trivfs_protid *cred, mutex_lock (&global_lock); - /* Validate CRED. XXX */ + if ((cred->po->openmodes & O_READ) == 0) + { + mutex_unlock (&global_lock); + return EBADF; + } while (!control_byte && (!qsize (outputq) || (termflags & USER_OUTPUT_SUSP))) @@ -282,7 +286,11 @@ pty_io_write (struct trivfs_protid *cred, mutex_lock (&global_lock); - /* Validate CRED. XXX */ + if ((cred->po->openmodes & O_WRITE) == 0) + { + mutex_unlock (&global_lock); + return EBADF; + } if (remote_input_mode) { @@ -349,8 +357,6 @@ pty_io_select (struct trivfs_protid *cred, mutex_lock (&global_lock); - /* Validate CRED. XXX */ - while (1) { if ((*type & SELECT_READ) && (control_byte || qsize (outputq))) -- cgit v1.2.3