Skip to content

Commit

Permalink
mongo mitigate slice out of bounds err
Browse files Browse the repository at this point in the history
  • Loading branch information
kenanfarukcakir committed Aug 1, 2024
1 parent 23cae4c commit e8c9e30
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aggregator/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,13 @@ func (a *Aggregator) parsePostgresCommand(d *l7_req.L7Event) (string, error) {
}

func (a *Aggregator) parseMongoEvent(d *l7_req.L7Event) (string, error) {
defer func() {
if r := recover(); r != nil {
log.Logger.Debug().Any("r", r).
Msg("recovered from mongo event,probably slice out of bounds")
}
}()

payload := d.Payload[:d.PayloadSize]

// cut mongo header, 4 bytes MessageLength, 4 bytes RequestID, 4 bytes ResponseTo, 4 bytes Opcode, 4 bytes MessageFlags
Expand Down

0 comments on commit e8c9e30

Please sign in to comment.