UserlandFS: avoid crash if module is not found.

If we can't find the name in the module list, we would try to
dereference the NULL pointer which terminates that list.
This commit is contained in:
Adrien Destugues 2014-11-17 11:49:26 +01:00
parent 5b1f411f57
commit 28627b28aa

View File

@ -398,7 +398,7 @@ userlandfs_create_file_system(const char* fsName, image_id image,
// find the module
file_system_module_info* module = NULL;
for (int32 i = 0; modules[i]->name; i++) {
for (int32 i = 0; modules[i] && modules[i]->name; i++) {
if (strcmp(modules[i]->name, moduleName) == 0) {
module = (file_system_module_info*)modules[i];
break;