summaryrefslogtreecommitdiffstats
path: root/sys/dev/wscons
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-03-30 08:04:35 +0000
committeranton <anton@openbsd.org>2019-03-30 08:04:35 +0000
commitfd7c80607c62a279652bac4d51f3a262bf408869 (patch)
tree6f260f90b99a38e7af6c852f4a7acb321f80c2e7 /sys/dev/wscons
parentFor now perform utimes, chown, chmod in the same order as cp(1), until (diff)
downloadwireguard-openbsd-fd7c80607c62a279652bac4d51f3a262bf408869.tar.xz
wireguard-openbsd-fd7c80607c62a279652bac4d51f3a262bf408869.zip
Restrict the number of allowed wsmux devices, just like wskbd and wsmouse
already does. Otherwise, malloc could panic if the device minor is sufficiently large. ok kettenis@ mpi@ visa@ Reported-by: syzbot+5a77a0fd8810d0785f61@syzkaller.appspotmail.com
Diffstat (limited to 'sys/dev/wscons')
-rw-r--r--sys/dev/wscons/wsmux.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index e31b9f68038..ebdd09a018f 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.44 2019/03/16 15:04:19 anton Exp $ */
+/* $OpenBSD: wsmux.c,v 1.45 2019/03/30 08:04:35 anton Exp $ */
/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -144,6 +144,9 @@ wsmux_getmux(int n)
struct wsmux_softc **new, **old;
int i;
+ if (n >= WSMUX_MAXDEV)
+ return (NULL);
+
/* Make sure there is room for mux n in the table */
if (n >= nwsmux) {
old = wsmuxdevs;