remove use of unterminated strings

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@283 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2002-07-17 18:29:41 +00:00
parent 16b9077c10
commit 08b993b215

View File

@ -265,12 +265,12 @@ static module_info **load_module_file(const char *path)
return NULL;
}
lm->path = (char*)kmalloc(strlen(path));
lm->path = (char*)kmalloc(strlen(path) + 1);
if (!lm->path) {
kfree(lm);
return NULL;
}
memcpy(lm->path, path, strlen(path));
strcpy(lm->path, path);
lm->ref_cnt = 0;
recursive_lock_lock(&modules_lock);
@ -338,12 +338,12 @@ static int simple_module_info(module_info *mod, const char *file, int offset)
SHOW_FLOW(3, "simple_module_info(%s, %s)\n", mod->name, file);
m->module = NULL; /* back pointer */
m->name = (char*)kmalloc(strlen(mod->name));
m->name = (char*)kmalloc(strlen(mod->name) + 1);
if (!m->name) {
kfree(m);
return -1;
}
memcpy(m->name, mod->name, strlen(mod->name));
strcpy(m->name, mod->name);
m->state = MOD_QUERIED;
/* Record where the module_info can be found */
m->offset = offset;