Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions pkg/api/confapi/confapi.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/sensors/exec/exec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func execParse(reader *bytes.Reader) (processapi.MsgProcess, bool, error) {
size := exec.Size - processapi.MSG_SIZEOF_EXECVE
if size > processapi.MSG_SIZEOF_BUFFER-processapi.MSG_SIZEOF_EXECVE {
err := errors.New("msg exec size larger than argsbuffer")
exec.Size = processapi.MSG_SIZEOF_EXECVE
proc.Size = processapi.MSG_SIZEOF_EXECVE
proc.Args = "enomem enomem"
proc.Filename = "enomem"
return proc, false, err
Expand Down
36 changes: 19 additions & 17 deletions pkg/sensors/exec/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,7 @@ func TestExecParse(t *testing.T) {
t.Fatalf("observer.InitDataCache: %s", err)
}

exec := processapi.MsgExec{
Size: processapi.MSG_SIZEOF_EXECVE,
}

exec := processapi.MsgExec{}
filename := []byte("/bin/krava")
cwd := []byte("/home/krava")

Expand All @@ -808,7 +805,9 @@ func TestExecParse(t *testing.T) {

var err error

{
t.Run("Empty args", func(t *testing.T) {
observer.DataPurge()

// - filename (string)
// - no args
// - cwd (string)
Expand All @@ -834,11 +833,11 @@ func TestExecParse(t *testing.T) {
decArgs, decCwd := proc.ArgsDecoder(process.Args, process.Flags)
assert.Empty(t, decArgs)
assert.Equal(t, string(cwd), decCwd)
}
})

observer.DataPurge()
t.Run("Filename as data event", func(t *testing.T) {
observer.DataPurge()

{
// - filename (data event)
// - no args
// - cwd (string)
Expand Down Expand Up @@ -870,11 +869,11 @@ func TestExecParse(t *testing.T) {
decArgs, decCwd := proc.ArgsDecoder(process.Args, process.Flags)
assert.Empty(t, decArgs)
assert.Equal(t, string(cwd), decCwd)
}
})

observer.DataPurge()
t.Run("Args as data event", func(t *testing.T) {
observer.DataPurge()

{
// - filename (string)
// - args (data event)
// - cwd (string)
Expand Down Expand Up @@ -911,11 +910,11 @@ func TestExecParse(t *testing.T) {
decArgs, decCwd := proc.ArgsDecoder(process.Args, process.Flags)
assert.Equal(t, "arg1 arg2", decArgs)
assert.Equal(t, string(cwd), decCwd)
}
})

observer.DataPurge()
t.Run("Filename and args as data event", func(t *testing.T) {
observer.DataPurge()

{
// - filename (data event)
// - args (data event)
// - cwd (string)
Expand Down Expand Up @@ -956,9 +955,11 @@ func TestExecParse(t *testing.T) {
decArgs, decCwd := proc.ArgsDecoder(process.Args, process.Flags)
assert.Equal(t, "arg1 arg2", decArgs)
assert.Equal(t, string(cwd), decCwd)
}
})

t.Run("Filename and args as non-utf8", func(t *testing.T) {
observer.DataPurge()

{
// - filename (non-utf8)
// - args (data event, non-utf8)
// - cwd (string)
Expand Down Expand Up @@ -997,7 +998,8 @@ func TestExecParse(t *testing.T) {
decArgs, decCwd := proc.ArgsDecoder(process.Args, process.Flags)
assert.Equal(t, "�( arg2", decArgs)
assert.Equal(t, strutils.UTF8FromBPFBytes(cwd), decCwd)
}
})

observer.DataPurge()
}

Expand Down
Loading