diff options
author | phk <phk@FreeBSD.org> | 2003-01-27 16:54:17 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-01-27 16:54:17 +0000 |
commit | 3b4c6dba6536b96f311f8c1f9aee2a3c4432099d (patch) | |
tree | 8238b6632aba6bfcd4db61ae4b6544aeb2125229 | |
parent | a322ce368223a2f55e23a927bf87c7010171c626 (diff) | |
download | FreeBSD-src-3b4c6dba6536b96f311f8c1f9aee2a3c4432099d.zip FreeBSD-src-3b4c6dba6536b96f311f8c1f9aee2a3c4432099d.tar.gz |
Don't dereference null vnode pointer if controling terminal was revoked.
Submitted by: "Peter Edwards" <pmedwards@eircom.net>
-rw-r--r-- | sys/kern/tty_tty.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index d962c18..88f4222 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -70,10 +70,12 @@ ctty_clone(void *arg, char *name, int namelen, dev_t *dev) return; if (strcmp(name, "tty")) return; - if (curthread->td_proc->p_flag & P_CONTROLT) - *dev = curthread->td_proc->p_session->s_ttyvp->v_rdev; - else + if (!(curthread->td_proc->p_flag & P_CONTROLT)) + *dev = ctty; + else if (curthread->td_proc->p_session->s_ttyvp == NULL) *dev = ctty; + else + *dev = curthread->td_proc->p_session->s_ttyvp->v_rdev; } static void |