summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/modules.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 3f88656ee..6445ead41 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -161,7 +161,7 @@ static int load_modules_dependencies(void)
start = ptr;
i = 0;
- while (start && *start) {
+ while (start && *start && i < sizeof(tmp_deps)/sizeof(char *)) {
ptr = strchr(start, ' ');
if (ptr) *ptr = '\0';
tmp_deps[i++] = filename2modname(start);
@@ -172,6 +172,12 @@ static int load_modules_dependencies(void)
while (start && *start && *start == ' ')
start++;
}
+ if(i >= sizeof(tmp_deps)/sizeof(char *)-1) {
+ log_message("warning, more than %d dependencies for module %s",
+ sizeof(tmp_deps)/sizeof(char *)-1,
+ modules_deps[line].modname);
+ i = sizeof(tmp_deps)/sizeof(char *)-1;
+ }
tmp_deps[i++] = NULL;
modules_deps[line].deps = memdup(tmp_deps, sizeof(char *) * i);