summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-08-10 14:51:10 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-08-10 14:51:10 +0000
commit9dd4acc6d35b24f7de0880e7862b46fa9f379860 (patch)
tree7a20544b27522c57e82bb1432724e26e89e15530 /mdk-stage1
parentcef5ece289e0a463fd3dac1e0191f0a3d39b708a (diff)
downloaddrakx-9dd4acc6d35b24f7de0880e7862b46fa9f379860.tar
drakx-9dd4acc6d35b24f7de0880e7862b46fa9f379860.tar.gz
drakx-9dd4acc6d35b24f7de0880e7862b46fa9f379860.tar.bz2
drakx-9dd4acc6d35b24f7de0880e7862b46fa9f379860.tar.xz
drakx-9dd4acc6d35b24f7de0880e7862b46fa9f379860.zip
Avoid smashing the stack if someday a module has more than 49 dependencies
Diffstat (limited to 'mdk-stage1')
-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);