From 4b044ae52cf8a127e40727d412621378b456b80a Mon Sep 17 00:00:00 2001 From: illiliti Date: Wed, 26 May 2021 13:37:02 +0300 Subject: [PATCH] udev_device.c: avoid off-by-one overflow --- udev_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index 1ccd566..dfc4431 100644 --- a/udev_device.c +++ b/udev_device.c @@ -363,7 +363,9 @@ static void make_bit(unsigned long *arr, int cnt, const char *str) } } - arr[i] = strtoul(str, NULL, 16); + if (i < cnt) { + arr[i] = strtoul(str, NULL, 16); + } } static int test_bit(unsigned long *arr, unsigned long bit)