[core] fix crash if 'host' empty in config (fixes #2876)

x-ref:
 "segfault with fastcgi app"
  https://redmine.lighttpd.net/issues/2876
personal/stbuehler/fix-fdevent
Glenn Strauss 5 years ago
parent 78e25f0f50
commit e21906b3b4

@ -1399,8 +1399,12 @@ int gw_set_defaults_backend(server *srv, gw_plugin_data *p, data_unset *du, size
host->port = 80;
}
host->family = (!buffer_string_is_empty(host->host)
&& NULL != strchr(host->host->ptr, ':'))
if (buffer_string_is_empty(host->host)) {
buffer_copy_string_len(host->host,
CONST_STR_LEN("127.0.0.1"));
}
host->family = (NULL != strchr(host->host->ptr, ':'))
? AF_INET6
: AF_INET;
}

Loading…
Cancel
Save