blob: a9182153d836014f21b9055ad6839b360ca0e8d1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--- base/process/process_handle_freebsd.cc.orig 2025-05-07 06:48:23 UTC
+++ base/process/process_handle_freebsd.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/process/process_handle.h"
+#include "base/files/file_util.h"
#include <limits.h>
#include <stddef.h>
@@ -20,10 +21,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, std::size(mib), &info, &length, NULL, 0) < 0) {
+ return -1;
+
+ if (length < sizeof(struct kinfo_proc))
return -1;
}
|