Skip to content

Commit

Permalink
fix[pcap]: check for nil packet and transport layer
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoutsovasilis committed Mar 31, 2024
1 parent 3f83fd6 commit c61f309
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/command/pcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ func (r *pcapRunner) sendPCAP(path string, out output.Output) error {
break
}

payloadData := packet.TransportLayer().LayerPayload()
if packet == nil {
logger.Warnw("Skipping nil packet")
continue
}

tl := packet.TransportLayer()
if tl == nil {
logger.Warnw("Skipping packet with no transport layer")
continue
}

payloadData := tl.LayerPayload()

// TODO: Rate-limit for UDP.
n, err := out.Write(payloadData)
Expand Down

0 comments on commit c61f309

Please sign in to comment.