aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMarvin Borner2021-02-26 14:51:13 +0100
committerMarvin Borner2021-02-26 14:51:13 +0100
commit0f00932955521c3c2fb8140176ab72f22172c298 (patch)
tree99561c0254d14c0c3536f900ee83b0341a5c8a1b /kernel
parentdec16faf32e75d613e20cac175b8a0c2d3612b94 (diff)
Started UBSan and stack-smashing check support
Diffstat (limited to 'kernel')
-rw-r--r--kernel/features/proc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index 35c0fa7..cdbe8b1 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -297,8 +297,9 @@ static s32 procfs_write(const char *path, void *buf, u32 offset, u32 count, stru
path++;
if (!memcmp(path, "msg", 4)) {
- // TODO: Messages should be copied by value not by reference
- stack_push_bot(p->messages, buf); // TODO: Use offset and count
+ void *msg_data = malloc(count);
+ memcpy(msg_data, buf, count);
+ stack_push_bot(p->messages, msg_data); // TODO: Use offset
proc_enable_waiting(pid, PROC_WAIT_MSG);
return count;
} else if (!memcmp(path, "io/", 3)) {
@@ -355,6 +356,7 @@ static s32 procfs_read(const char *path, void *buf, u32 offset, u32 count, struc
if (!msg)
return -1;
memcpy(buf, msg + offset, count);
+ free(msg);
return count;
}
} else if (!memcmp(path, "io/", 3)) {