From ce4063f14f4b8adfd804f4127c14b7bef722a1f5 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Wed, 5 Apr 2017 14:17:37 -0700 Subject: [PATCH] [runtime] Don't return the modules for the current process when pid != getpid (). --- mono/metadata/w32process-unix-osx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mono/metadata/w32process-unix-osx.c b/mono/metadata/w32process-unix-osx.c index 9c4bdc25f7f..481d228dd20 100644 --- a/mono/metadata/w32process-unix-osx.c +++ b/mono/metadata/w32process-unix-osx.c @@ -8,6 +8,7 @@ #ifdef USE_OSX_BACKEND #include +#include #include #include #include @@ -120,9 +121,13 @@ mono_w32process_get_modules (pid_t pid) { GSList *ret = NULL; MonoW32ProcessModule *mod; - guint32 count = _dyld_image_count (); + guint32 count; int i = 0; + if (pid != getpid ()) + return NULL; + + count = _dyld_image_count (); for (i = 0; i < count; i++) { #if SIZEOF_VOID_P == 8 const struct mach_header_64 *hdr; -- 2.25.1