diff options
author | 2009-10-28 16:56:46 +0000 | |
---|---|---|
committer | 2009-10-28 16:56:46 +0000 | |
commit | fab137a1d98f9cac89f2da58d9afe09c5372b0e0 (patch) | |
tree | 62db85f3cf7c6f8dcbab98f0832c7375978387fb | |
parent | Add compat errno mappings for the ENOTSUP errno addition. (diff) | |
download | wireguard-openbsd-fab137a1d98f9cac89f2da58d9afe09c5372b0e0.tar.xz wireguard-openbsd-fab137a1d98f9cac89f2da58d9afe09c5372b0e0.zip |
For the TIOCSET* ioctls, validate that the tty speeds are positive (since
they are signed int)
ok miod guenther
-rw-r--r-- | sys/kern/tty.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 378a801f594..1d78066931a 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.80 2009/07/19 08:16:06 blambert Exp $ */ +/* $OpenBSD: tty.c,v 1.81 2009/10/28 16:56:46 deraadt Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -876,6 +876,13 @@ ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) } if (!ISSET(t->c_cflag, CIGNORE)) { /* + * Some minor validation is neccessary. + */ + if (t->c_ispeed < 0 || t->c_ospeed < 0) { + splx(s); + return (EINVAL); + } + /* * Set device hardware. */ if (tp->t_param && (error = (*tp->t_param)(tp, t))) { |