Skip to content

Commit

Permalink
fix(process,linux): remove trailing multiple \x00
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Jul 12, 2022
1 parent 46f7642 commit e2ae339
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions process/process_linux.go
Expand Up @@ -688,9 +688,9 @@ func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string
if len(cmdline) == 0 {
return nil, nil
}
if cmdline[len(cmdline)-1] == 0 {
cmdline = cmdline[:len(cmdline)-1]
}

cmdline = bytes.TrimRight(cmdline, "\x00")

parts := bytes.Split(cmdline, []byte{0})
var strParts []string
for _, p := range parts {
Expand Down

0 comments on commit e2ae339

Please sign in to comment.