summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2021-08-31 05:16:46 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2021-08-31 05:16:46 +0000
commita4c5b97a26e17ce681d3e773d7013f848e49ada2 (patch)
treef9feffa5ec99680d60b394ff81d9b147fad7da62 /sys/dev
parente55fd2619aaba6001aa4e0a47efe9839eccb9b41 (diff)
Protect against missing bit to key symbols in ucc_bit_to_sym(). This can
only happen if ucc_hid_parse() has a bug, better play it safe.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/ucc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/usb/ucc.c b/sys/dev/usb/ucc.c
index 96bfcc1518b..39e588dee76 100644
--- a/sys/dev/usb/ucc.c
+++ b/sys/dev/usb/ucc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ucc.c,v 1.19 2021/08/29 19:00:59 anton Exp $ */
+/* $OpenBSD: ucc.c,v 1.20 2021/08/31 05:16:45 anton Exp $ */
/*
* Copyright (c) 2021 Anton Lindqvist <anton@openbsd.org>
@@ -1003,7 +1003,7 @@ ucc_add_key(struct ucc_softc *sc, int32_t usage, u_int bit)
int
ucc_bit_to_sym(struct ucc_softc *sc, u_int bit, const struct ucc_keysym **us)
{
- if (bit >= sc->sc_rawsiz)
+ if (bit >= sc->sc_rawsiz || sc->sc_raw[bit] == NULL)
return 1;
*us = sc->sc_raw[bit];
return 0;