diff options
author | des <des@FreeBSD.org> | 2002-05-28 14:29:56 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-05-28 14:29:56 +0000 |
commit | 577e468b90c7207e03ebf864c9891a23573253d1 (patch) | |
tree | ceab5576caebcf63bdd00dbe2b47a31ec3771753 /sys/kern/tty.c | |
parent | 8ba975c439aebe9d6f4c3a56a1ca957f258c14c4 (diff) | |
download | FreeBSD-src-577e468b90c7207e03ebf864c9891a23573253d1.zip FreeBSD-src-577e468b90c7207e03ebf864c9891a23573253d1.tar.gz |
Add some checks to prevent NULL dereferences.
Submitted by: jhay
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 1cd71ef..d571c72 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -2593,12 +2593,15 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) xt.xt_cancc = tp->t_canq.c_cc; xt.xt_outcc = tp->t_outq.c_cc; XT_COPY(line); - xt.xt_dev = dev2udev(tp->t_dev); + if (tp->t_dev) + xt.xt_dev = dev2udev(tp->t_dev); XT_COPY(state); XT_COPY(flags); XT_COPY(timeout); - xt.xt_pgid = tp->t_pgrp->pg_id; - xt.xt_sid = tp->t_session->s_sid; + if (tp->t_pgrp) + xt.xt_pgid = tp->t_pgrp->pg_id; + if (tp->t_session) + xt.xt_sid = tp->t_session->s_sid; XT_COPY(termios); XT_COPY(winsize); XT_COPY(column); |