Skip to content
Snippets Groups Projects
Commit 304dcae8 authored by Adam Wujek's avatar Adam Wujek :speech_balloon:
Browse files

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


Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 66839567
Branches
Tags
No related merge requests found
...@@ -427,7 +427,8 @@ static void get_loaded_kernel_modules_status(void) ...@@ -427,7 +427,8 @@ static void get_loaded_kernel_modules_status(void)
continue; /* error... or EOF */ continue; /* error... or EOF */
/* try educated guess to find position in array */ /* 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++; modules_found++;
guess_index++; guess_index++;
continue; continue;
......
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