From 2f55ffdf205451feff0da676aa364faafb7cabe2 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 20 Aug 2020 16:15:24 +0200 Subject: [PATCH] libc: zero-initialize anonymous memory from 'mmap()' Fixes #3854 --- repos/libports/src/lib/libc/file_operations.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/repos/libports/src/lib/libc/file_operations.cc b/repos/libports/src/lib/libc/file_operations.cc index 07b5fd51d5..e892dab551 100644 --- a/repos/libports/src/lib/libc/file_operations.cc +++ b/repos/libports/src/lib/libc/file_operations.cc @@ -422,6 +422,7 @@ __SYS_(void *, mmap, (void *addr, ::size_t length, errno = ENOMEM; return MAP_FAILED; } + ::memset(start, 0, align_addr(length, PAGE_SHIFT)); mmap_registry()->insert(start, length, 0); return start; }