summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-10-28 16:56:46 +0000
committerderaadt <deraadt@openbsd.org>2009-10-28 16:56:46 +0000
commitfab137a1d98f9cac89f2da58d9afe09c5372b0e0 (patch)
tree62db85f3cf7c6f8dcbab98f0832c7375978387fb
parentAdd compat errno mappings for the ENOTSUP errno addition. (diff)
downloadwireguard-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.c9
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))) {