summaryrefslogtreecommitdiff
path: root/sys/dev/wsfont/wsfont.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/wsfont/wsfont.c')
-rw-r--r--sys/dev/wsfont/wsfont.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/wsfont/wsfont.c b/sys/dev/wsfont/wsfont.c
index b6fda1c745d..f55c2a388a7 100644
--- a/sys/dev/wsfont/wsfont.c
+++ b/sys/dev/wsfont/wsfont.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsfont.c,v 1.43 2016/09/04 18:20:34 tedu Exp $ */
+/* $OpenBSD: wsfont.c,v 1.44 2016/09/14 03:25:51 jcs Exp $ */
/* $NetBSD: wsfont.c,v 1.17 2001/02/07 13:59:24 ad Exp $ */
/*-
@@ -450,7 +450,7 @@ wsfont_add(struct wsdisplay_font *font, int copy)
{
static int cookiegen = 666;
struct font *ent;
- int s;
+ int s, fontc = 0;
s = splhigh();
@@ -461,6 +461,14 @@ wsfont_add(struct wsdisplay_font *font, int copy)
return (-1);
}
+ TAILQ_FOREACH(ent, &fontlist, chain)
+ fontc++;
+
+ if (fontc >= WSDISPLAY_MAXFONTCOUNT) {
+ splx(s);
+ return (-1);
+ }
+
ent = (struct font *)malloc(sizeof *ent, M_DEVBUF, M_WAITOK);
ent->lockcount = 0;