Commit 304dcae8 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/snmpd: don't crash when number of kernel modules greater than expected

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 66839567
......@@ -427,7 +427,8 @@ static void get_loaded_kernel_modules_status(void)
continue; /* error... or EOF */
/* try educated guess to find position in array */
if (!strncmp(key, kernel_modules[guess_index].key, 40)) {
if (guess_index < ARRAY_SIZE(kernel_modules)
&& !strncmp(key, kernel_modules[guess_index].key, 40)) {
modules_found++;
guess_index++;
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment