Skip to content

Commit

Permalink
Remove length checks on pflog packets for it's always false.
Browse files Browse the repository at this point in the history
It was verified that PFLOG_HDRLEN is always 100 on BE/LE and w/ or w/o
strict alignment requirements.
  • Loading branch information
jasperla committed Apr 6, 2016
1 parent f07b94e commit 5db802b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions layers/pflog.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package layers

import (
"encoding/binary"
"errors"

"github.com/tsg/gopacket"
)
Expand Down Expand Up @@ -52,12 +51,8 @@ func (pf *PFLog) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
pf.RuleUID = binary.BigEndian.Uint32(data[52:56])
pf.RulePID = int32(binary.BigEndian.Uint32(data[56:60]))
pf.Direction = PFDirection(data[60])
if pf.Length%4 != 1 {
return errors.New("PFLog header length should be 3 less than multiple of 4")
}
actualLength := int(pf.Length) + 3
pf.Contents = data[:actualLength]
pf.Payload = data[actualLength:]
pf.Contents = data[:pf.Length]
pf.Payload = data[pf.Length:]
return nil
}

Expand Down

0 comments on commit 5db802b

Please sign in to comment.