From fea7c6a78b75cf4f218d3b6c75c9c185eb7872ad Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 17 Mar 2006 03:21:57 +0000 Subject: [PATCH] Fix range to check to avoid a static buffer overrun, when font->encoding == 4, which would cause access past the end of the encodings array. Fixes Coverity CID 1446. Note that perhaps we should actually have an encoding line for WSDISPLAY_FONTENC_ISO2 which is encoding 4. --- sys/dev/wsfont/wsfont.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/wsfont/wsfont.c b/sys/dev/wsfont/wsfont.c index cd2da5d17082..ef273a7338a1 100644 --- a/sys/dev/wsfont/wsfont.c +++ b/sys/dev/wsfont/wsfont.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsfont.c,v 1.40 2005/12/24 23:41:34 perry Exp $ */ +/* $NetBSD: wsfont.c,v 1.41 2006/03/17 03:21:57 chris Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.40 2005/12/24 23:41:34 perry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.41 2006/03/17 03:21:57 chris Exp $"); #include "opt_wsfont.h" @@ -714,7 +714,7 @@ wsfont_map_unichar(struct wsdisplay_font *font, int c) if (font->encoding == WSDISPLAY_FONTENC_ISO) return (c); - if (font->encoding < 0 || font->encoding > MAX_ENCODING) + if (font->encoding < 0 || font->encoding >= MAX_ENCODING) return (-1); hi = (c >> 8);