Skip to content

Commit

Permalink
Adding a guard to fix crashing when nil custom ip is found
Browse files Browse the repository at this point in the history
  • Loading branch information
i3149 committed Dec 10, 2024
1 parent 0c4f097 commit 5b8d2f6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/cat/jchf.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,15 @@ func (kc *KTranslate) flowToJCHF(ctx context.Context, dst *kt.JCHF, src *Flow, c
dst.CustomStr[name] = sv
case model.Custom_value_Which_addrVal:
sv, _ := val.AddrVal()
var addr net.IP
if sv[0] == 4 {
addr = net.IP(sv[1:5])
} else {
addr = net.IP(sv[1:])
if len(sv) > 1 {
var addr net.IP
if sv[0] == 4 && len(sv) == 5 {
addr = net.IP(sv[1:5])
} else {
addr = net.IP(sv[1:])
}
dst.CustomStr[name] = addr.String()
}
dst.CustomStr[name] = addr.String()
}
}

Expand Down

0 comments on commit 5b8d2f6

Please sign in to comment.