Skip to content

Commit

Permalink
fix(inputs.phpfpm): Check address length to avoid crash (influxdata#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Jul 5, 2023
1 parent 445a4eb commit eb43ee2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/inputs/phpfpm/phpfpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ func (p *phpfpm) gatherServer(addr string, acc telegraf.Accumulator) error {
return fmt.Errorf("unable parse server address %q: %w", addr, err)
}
socketAddr := strings.Split(u.Host, ":")
if len(socketAddr) < 2 {
return fmt.Errorf("url does not follow required 'address:port' format: %s", u.Host)
}
fcgiIP := socketAddr[0]
fcgiPort, _ := strconv.Atoi(socketAddr[1])
fcgi, err = newFcgiClient(fcgiIP, fcgiPort)
Expand Down

0 comments on commit eb43ee2

Please sign in to comment.