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)