Skip to content

Commit

Permalink
fix(events): fix slice out of bounds in hidden_kernel_module (#4379)
Browse files Browse the repository at this point in the history
  • Loading branch information
OriGlassman authored Nov 11, 2024
1 parent 79cfd5f commit 1fdb3f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/events/derive/hidden_kernel_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,17 @@ func extractFromEvent(args []trace.Argument, address uint64) []interface{} {
}

// Parse module srcversion if possible
var srcversion string
srcversion := ""
srcversionBytes, err := parse.ArgVal[[]byte](args, "srcversion")
if err != nil {
srcversion = ""
// Don't fail hard, submit it without a srcversion!
logger.Debugw("Failed extracting hidden module srcversion")
} else {
// Remove the trailing terminating characters
srcversion = string(srcversionBytes[:bytes.IndexByte(srcversionBytes[:], 0)])
index := bytes.IndexByte(srcversionBytes[:], 0)
if index > 0 {
srcversion = string(srcversionBytes[:index])
}
}

addrHex := fmt.Sprintf("0x%x", address)
Expand Down

0 comments on commit 1fdb3f0

Please sign in to comment.