Fixed small bug in how procinfo reads sysctl KERN_PROCARGS2

This commit is contained in:
Mikayla Maki authored and Wez Furlong committed 2022-09-06 20:14:27 -07:00
1 parent 6166008b18
commit ffae6818ef
1 file changed
+5
+5
View File
@@ -178,6 +178,11 @@ impl LocalProcessInfo {
let exe_path = consume_cstr(&mut ptr)?.into();
// For some reason, sysctl sometimes puts some null bytes
// between the executable field and the argv field
let not_nul = ptr.iter().position(|&c| c != 0)?;
ptr = ptr.get(not_nul..)?;
let mut args = vec![];
for _ in 0..argc {
args.push(consume_cstr(&mut ptr)?);