From e62d9911eac981cb93a1f972adf4305c7edf07ad Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 3 Dec 2011 23:13:52 +0100 Subject: [PATCH] Allocate as much as is later read, didn't do harm though. Further in the process the flat argument size is rounded up, but the actual allocation was done with the unaligned size causing an access beyond the allocation when later copying the flat arguments. It didn't do any actual harm as the block sizes of our allocator(s) use elements that have at least such an alignment. --- src/system/kernel/team.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index 3d693e4a8d..61903e53ff 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -1378,7 +1378,7 @@ copy_user_process_args(const char* const* userFlatArgs, size_t flatArgsSize, return B_BAD_ADDRESS; // allocate kernel memory - char** flatArgs = (char**)malloc(flatArgsSize); + char** flatArgs = (char**)malloc(_ALIGN(flatArgsSize)); if (flatArgs == NULL) return B_NO_MEMORY;