summaryrefslogtreecommitdiff
path: root/www/chromium/patches/patch-base_process_process_handle_freebsd_cc
blob: 44a2e4736b7ff146bf87dfd83a0595b127b07212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Index: base/process/process_handle_freebsd.cc
--- base/process/process_handle_freebsd.cc.orig
+++ base/process/process_handle_freebsd.cc
@@ -12,15 +12,19 @@
 #include <unistd.h>
 
 #include "base/cxx17_backports.h"
+#include "base/files/file_path.h"
 
 namespace base {
 
 ProcessId GetParentProcessId(ProcessHandle process) {
   struct kinfo_proc info;
-  size_t length;
+  size_t length = sizeof(struct kinfo_proc);
   int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
 
   if (sysctl(mib, base::size(mib), &info, &length, NULL, 0) < 0)
+    return -1;
+
+  if (length < sizeof(struct kinfo_proc))
     return -1;
 
   return info.ki_ppid;