obj: fix kmalloc'd namespace paths not being null-terminated
This commit is contained in:
@@ -114,12 +114,13 @@ kern_status_t object_namespace_get_object(struct object_namespace *ns, const cha
|
||||
}
|
||||
|
||||
size_t parts = 0;
|
||||
char *rpath = kmalloc(path_len, 0);
|
||||
char *rpath = kmalloc(path_len + 1, 0);
|
||||
if (!rpath) {
|
||||
return KERN_NO_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(rpath, path, path_len);
|
||||
rpath[path_len] = 0;
|
||||
cleanup_object_path(rpath, path_len, &parts);
|
||||
|
||||
char *sp;
|
||||
@@ -190,12 +191,13 @@ kern_status_t object_namespace_create_link(struct object_namespace *ns, const ch
|
||||
}
|
||||
|
||||
size_t parts = 0;
|
||||
char *rpath = kmalloc(path_len, 0);
|
||||
char *rpath = kmalloc(path_len + 1, 0);
|
||||
if (!rpath) {
|
||||
return KERN_NO_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(rpath, linkpath, path_len);
|
||||
rpath[path_len] = 0;
|
||||
cleanup_object_path(rpath, path_len, &parts);
|
||||
|
||||
char *p = rpath + strlen(rpath) - 1;
|
||||
|
||||
Reference in New Issue
Block a user