From 08b993b215eacef57fc112bf20267c669ff62071 Mon Sep 17 00:00:00 2001 From: beveloper Date: Wed, 17 Jul 2002 18:29:41 +0000 Subject: [PATCH] remove use of unterminated strings git-svn-id: file:///srv/svn/repos/haiku/trunk/current@283 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/module.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kernel/core/module.c b/src/kernel/core/module.c index 5070db6e22..40c183e49e 100644 --- a/src/kernel/core/module.c +++ b/src/kernel/core/module.c @@ -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;