[runtime] Don't return the modules for the current process when pid != getpid ().
authorRodrigo Kumpera <kumpera@gmail.com>
Wed, 5 Apr 2017 21:17:37 +0000 (14:17 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 5 Apr 2017 21:18:26 +0000 (14:18 -0700)
mono/metadata/w32process-unix-osx.c

index 9c4bdc25f7fc872dbce66531a984a8c61b9384b8..481d228dd2046c9fd15863474f86912295ca7d25 100644 (file)
@@ -8,6 +8,7 @@
 #ifdef USE_OSX_BACKEND
 
 #include <errno.h>
+#include <unistd.h>
 #include <sys/time.h>
 #include <sys/proc.h>
 #include <sys/sysctl.h>
@@ -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;