[core] fix crash if invalid config file (fixes #2798)
If lighttpd.conf is invalid, some modules may not have initialized their per-context config structures, but will have their free-functions called, which should not be run on uninitialized per-context configs. x-ref: "Segfault with simple-vhost.debug = "enable"" https://redmine.lighttpd.net/issues/2798
This commit is contained in:
parent
46ff978fa0
commit
1485cb401b
|
@ -113,7 +113,9 @@ FREE_FUNC(mod_openssl_free)
|
|||
if (p->config_storage) {
|
||||
for (size_t i = 0; i < srv->config_context->used; ++i) {
|
||||
plugin_config *s = p->config_storage[i];
|
||||
int copy = s->ssl_enabled && buffer_string_is_empty(s->ssl_pemfile);
|
||||
int copy;
|
||||
if (NULL == s) continue;
|
||||
copy = s->ssl_enabled && buffer_string_is_empty(s->ssl_pemfile);
|
||||
buffer_free(s->ssl_pemfile);
|
||||
buffer_free(s->ssl_ca_file);
|
||||
buffer_free(s->ssl_cipher_list);
|
||||
|
|
|
@ -55,6 +55,7 @@ FREE_FUNC(mod_simple_vhost_free) {
|
|||
size_t i;
|
||||
for (i = 0; i < srv->config_context->used; i++) {
|
||||
plugin_config *s = p->config_storage[i];
|
||||
if (NULL == s) continue;
|
||||
|
||||
buffer_free(s->document_root);
|
||||
buffer_free(s->default_host);
|
||||
|
|
|
@ -85,6 +85,7 @@ FREE_FUNC(mod_status_free) {
|
|||
size_t i;
|
||||
for (i = 0; i < srv->config_context->used; i++) {
|
||||
plugin_config *s = p->config_storage[i];
|
||||
if (NULL == s) continue;
|
||||
|
||||
buffer_free(s->status_url);
|
||||
buffer_free(s->statistics_url);
|
||||
|
|
Loading…
Reference in New Issue