Skip to content

Commit

Permalink
fix(ipip): index out of range [4] with length 3
Browse files Browse the repository at this point in the history
fix #126
  • Loading branch information
childe committed Mar 2, 2021
1 parent 476ec49 commit 9138c6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions filter/ipip.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ func (plugin *IPIPFilter) Filter(event map[string]interface{}) (map[string]inter
event["country_name"] = a[0]
event["province_name"] = a[1]
event["city_name"] = a[2]
event["isp"] = a[4]
if len(a) >= 5 {
event["isp"] = a[4]
}
if len(a) >= 10 {
latitude, _ := strconv.ParseFloat(a[5], 10)
longitude, _ := strconv.ParseFloat(a[6], 10)
Expand All @@ -115,7 +117,9 @@ func (plugin *IPIPFilter) Filter(event map[string]interface{}) (map[string]inter
target["country_name"] = a[0]
target["province_name"] = a[1]
target["city_name"] = a[2]
target["isp"] = a[4]
if len(a) >= 5 {
target["isp"] = a[4]
}
if len(a) >= 10 {
latitude, _ := strconv.ParseFloat(a[5], 10)
longitude, _ := strconv.ParseFloat(a[6], 10)
Expand Down

0 comments on commit 9138c6e

Please sign in to comment.