Skip to content

Commit 71458d7

Browse files
committed
fix panic in python cmdline parsing
1 parent 5f605f5 commit 71458d7

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)