Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Bump the implementation limit on the number of modules in modLoaded. (http://www.linux-archive.org/debian-user/544978-bump-implementation-limit-number-modules-modloaded.html)

Ales Kozumplik 06-27-2011 01:50 PM

Bump the implementation limit on the number of modules in modLoaded.
 
After 08a79cbfb36b3a339a2aa34f02eec23b021a70bf we are over the current and
the loader segvs quite reliably.

Resolves: rhbz#716836
---
loader2/modules.c | 4 +++-
loader2/modules.h | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/loader2/modules.c b/loader2/modules.c
index 7f4dce3..cb34dff 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -335,6 +335,9 @@ static int loadModule(const char * modName, struct extractedModule * path,

if (!rc) {
int num = modLoaded->numModules;
+ if (num >= MODULES_MAXLOADED)
+ logMessage(CRITICAL, "The number of loaded modules is over the "
+ "implementation limit.");

modLoaded->mods[num].name = strdup(modName);
modLoaded->mods[num].weLoaded = 1;
@@ -390,7 +393,6 @@ static int loadModule(const char * modName, struct extractedModule * path,
} else {
newArgs = NULL;
}
-
modLoaded->mods[modLoaded->numModules++].args = newArgs;
}

diff --git a/loader2/modules.h b/loader2/modules.h
index 536a199..a12a235 100644
--- a/loader2/modules.h
+++ b/loader2/modules.h
@@ -4,6 +4,8 @@
#include "moduleinfo.h"
#include "moduledeps.h"

+#define MODULES_MAXLOADED 256
+
typedef struct moduleList_s * moduleList;

struct loadedModuleInfo {
@@ -23,7 +25,7 @@ struct extractedModule {
};

struct moduleList_s {
- struct loadedModuleInfo mods[100];
+ struct loadedModuleInfo mods[MODULES_MAXLOADED];
int numModules;
};

--
1.7.5.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 09:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.