blob: 34da38ffcf3c09f39cdc0d8100a8725468fc9712 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
--- base/process/process_handle_freebsd.cc.orig 2019-09-10 10:42:27 UTC
+++ base/process/process_handle_freebsd.cc
@@ -16,10 +16,13 @@ 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;
|