Skip to content

Commit 28105e5

Browse files
authored
Merge pull request #265 from coroot/issue_260
fix panic in python cmdline parsing
2 parents 5f605f5 + 71458d7 commit 28105e5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

containers/process.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ func (p *Process) instrumentPython(cmdline []byte, tracer *ebpftracer.Tracer) {
110110
if len(cmd) == 0 {
111111
return
112112
}
113-
cmd = bytes.TrimSuffix(bytes.Fields(cmd)[0], []byte{':'})
113+
cmdFields := bytes.Fields(cmd)
114+
if len(cmdFields) == 0 {
115+
return
116+
}
117+
cmd = bytes.TrimSuffix(cmdFields[0], []byte{':'})
114118
if !pythonCmd.Match(cmd) {
115119
return
116120
}

0 commit comments

Comments
 (0)