Skip to content
Permalink
Browse files

Restrict the number of allowed wsmux devices, just like wskbd and wsm…

…ouse

already does. Otherwise, malloc could panic if the device minor is sufficiently
large.

ok kettenis@ mpi@ visa@

Reported-by: syzbot+5a77a0fd8810d0785f61@syzkaller.appspotmail.com
  • Loading branch information...
anton
anton committed Mar 30, 2019
1 parent afb5473 commit fd7c80607c62a279652bac4d51f3a262bf408869
Showing with 4 additions and 1 deletion.
  1. +4 −1 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;

0 comments on commit fd7c806

Please sign in to comment.
You can’t perform that action at this time.