From 9b9060cab4be7f0b03a3f31dedc4d02fdc1399a0 Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 5 Aug 2022 16:59:50 +0000 Subject: [PATCH] Fix bounds check in ucc_add_key(); ok anton@ --- sys/dev/usb/ucc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/ucc.c b/sys/dev/usb/ucc.c index aacf7d7f796..7f08db1a0db 100644 --- a/sys/dev/usb/ucc.c +++ b/sys/dev/usb/ucc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucc.c,v 1.33 2022/03/29 16:04:36 anton Exp $ */ +/* $OpenBSD: ucc.c,v 1.34 2022/08/05 16:59:50 miod Exp $ */ /* * Copyright (c) 2021 Anton Lindqvist @@ -1013,7 +1013,7 @@ ucc_add_key(struct ucc_softc *sc, int32_t usage, u_int bit) if (ucc_usage_to_sym(usage, &us)) return 0; - if (sc->sc_maplen + 2 > sc->sc_mapsiz) + if (sc->sc_maplen + 2 >= sc->sc_mapsiz) return ENOMEM; sc->sc_map[sc->sc_maplen++] = KS_KEYCODE(sc->sc_isarray ? usage : bit); sc->sc_map[sc->sc_maplen++] = us->us_key; -- 2.20.1