diff options
author | Pascal Vorwerk <info@fossores.de> | 2023-09-11 01:08:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-10 19:08:02 -0400 |
commit | 1e0dea59efc606f0eaec09993649930d12961bb9 (patch) | |
tree | 30c91e8a7da002a237b2c4957bba9a3df06237b1 /modules/caddyhttp/reverseproxy | |
parent | 2cac3c5491e6428441ecf668cc4f5a86e67ed9b3 (diff) |
reverseproxy: fix nil pointer dereference in AUpstreams.GetUpstreams (#5811)
fix a nil pointer dereference in AUpstreams.GetUpstreams when AUpstreams.Versions is not set (fixes caddyserver#5809)
Signed-off-by: Pascal Vorwerk <info@fossores.de>
Diffstat (limited to 'modules/caddyhttp/reverseproxy')
-rw-r--r-- | modules/caddyhttp/reverseproxy/upstreams.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/reverseproxy/upstreams.go b/modules/caddyhttp/reverseproxy/upstreams.go index 09efdd5..528e2c5 100644 --- a/modules/caddyhttp/reverseproxy/upstreams.go +++ b/modules/caddyhttp/reverseproxy/upstreams.go @@ -297,8 +297,8 @@ func (au *AUpstreams) Provision(_ caddy.Context) error { func (au AUpstreams) GetUpstreams(r *http.Request) ([]*Upstream, error) { repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer) - resolveIpv4 := au.Versions.IPv4 == nil || *au.Versions.IPv4 - resolveIpv6 := au.Versions.IPv6 == nil || *au.Versions.IPv6 + resolveIpv4 := au.Versions == nil || au.Versions.IPv4 == nil || *au.Versions.IPv4 + resolveIpv6 := au.Versions == nil || au.Versions.IPv6 == nil || *au.Versions.IPv6 // Map ipVersion early, so we can use it as part of the cache-key. // This should be fairly inexpensive and comes and the upside of |