Fix nil pointer dereference segfault when passing "null" config json to cloudflared tunnel ingress validate (#1070)

This commit is contained in:
Sam Cook
2023-12-14 16:29:40 +00:00
committed by GitHub
parent a4a84bb27e
commit f2c4fdb0ae
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ type Ingress struct {
// ParseIngress parses ingress rules, but does not send HTTP requests to the origins.
func ParseIngress(conf *config.Configuration) (Ingress, error) {
if len(conf.Ingress) == 0 {
if conf == nil || len(conf.Ingress) == 0 {
return Ingress{}, ErrNoIngressRules
}
return validateIngress(conf.Ingress, originRequestFromConfig(conf.OriginRequest))