Fixed small bug in how procinfo reads sysctl KERN_PROCARGS2
This commit is contained in:
1 parent
6166008b18
commit
ffae6818ef
1 file changed
+5
@@ -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)?);
|
||||
|
||||
Reference in new issue
Block a user