Skip to content

Commit

Permalink
Merge pull request #1326 from shirou/feature/fix-cmdline-cutset
Browse files Browse the repository at this point in the history
fix(process,linux): remove trailing multiple \x00
  • Loading branch information
shirou authored Jul 14, 2022
2 parents 46f7642 + e2ae339 commit aa3f5a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions process/process_linux.go
Original file line number Diff line number Diff line change
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 aa3f5a5

Please sign in to comment.