From 17a638a4c27f17b267fb6cbb4fca45fd17184b4f Mon Sep 17 00:00:00 2001 From: Amit Schendel Date: Tue, 26 Nov 2024 09:27:32 +0000 Subject: [PATCH] Fixing empty exec path Signed-off-by: Amit Schendel --- pkg/ruleengine/v1/helpers.go | 4 +++- pkg/utils/utils.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/ruleengine/v1/helpers.go b/pkg/ruleengine/v1/helpers.go index 9cd5c84f..70baa642 100644 --- a/pkg/ruleengine/v1/helpers.go +++ b/pkg/ruleengine/v1/helpers.go @@ -33,7 +33,9 @@ var ( func getExecPathFromEvent(event *tracerexectype.Event) string { if len(event.Args) > 0 { - return event.Args[0] + if event.Args[0] != "" { + return event.Args[0] + } } return event.Comm } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index b81d6e3b..7dded0a6 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -441,7 +441,9 @@ func GetHostFilePathFromEvent(event K8sEvent, containerPid uint32) (string, erro // Get the path of the executable from the given event. func GetExecPathFromEvent(event *tracerexectype.Event) string { if len(event.Args) > 0 { - return event.Args[0] + if event.Args[0] != "" { + return event.Args[0] + } } return event.Comm }