appsec: avoid nil dereference (#2773)
This commit is contained in:
parent
84606eb207
commit
4b8e6cd780
1 changed files with 2 additions and 2 deletions
|
@ -329,7 +329,7 @@ func NewParsedRequestFromRequest(r *http.Request, logger *logrus.Entry) (ParsedR
|
|||
return ParsedRequest{}, fmt.Errorf("unable to parse url '%s': %s", clientURI, err)
|
||||
}
|
||||
|
||||
remoteAddrNormalized := ""
|
||||
var remoteAddrNormalized string
|
||||
host, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
log.Errorf("Invalid appsec remote IP source %v: %s", r.RemoteAddr, err.Error())
|
||||
|
@ -337,7 +337,7 @@ func NewParsedRequestFromRequest(r *http.Request, logger *logrus.Entry) (ParsedR
|
|||
} else {
|
||||
ip := net.ParseIP(host)
|
||||
if ip == nil {
|
||||
log.Errorf("Invalid appsec remote IP address source %v: %s", r.RemoteAddr, err.Error())
|
||||
log.Errorf("Invalid appsec remote IP address source %v", r.RemoteAddr)
|
||||
remoteAddrNormalized = r.RemoteAddr
|
||||
} else {
|
||||
remoteAddrNormalized = ip.String()
|
||||
|
|
Loading…
Reference in a new issue