Skip to content

Commit

Permalink
Avoid returning slice into buffer from Readfile
Browse files Browse the repository at this point in the history
Signed-off-by: eriknordmark <[email protected]>
  • Loading branch information
eriknordmark committed Feb 8, 2021
1 parent 3585d27 commit 0e13743
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions process/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,12 @@ func (p *Process) fillFromStatusWithContext(ctx context.Context) error {
}
}
}
// Ensure we have a copy and not reference into slice
p.name = string([]byte(p.name))
case "State":
p.status = value[0:1]
// Ensure we have a copy and not reference into slice
p.status = string([]byte(p.status))
case "PPid", "Ppid":
pval, err := strconv.ParseInt(value, 10, 32)
if err != nil {
Expand Down

0 comments on commit 0e13743

Please sign in to comment.