]> TLD Linux GIT Repositories - packages/lighttpd.git/blob - lighttpd-bug-2876.patch
- merged 1.4.49 from PLD
[packages/lighttpd.git] / lighttpd-bug-2876.patch
1 From e21906b3b41cda3cefebcc8b96ae6ad08549e504 Mon Sep 17 00:00:00 2001
2 From: Glenn Strauss <gstrauss@gluelogic.com>
3 Date: Thu, 15 Mar 2018 23:21:37 -0400
4 Subject: [PATCH] [core] fix crash if 'host' empty in config (fixes #2876)
5
6 x-ref:
7  "segfault with fastcgi app"
8   https://redmine.lighttpd.net/issues/2876
9 ---
10  src/gw_backend.c | 8 ++++++--
11  1 file changed, 6 insertions(+), 2 deletions(-)
12
13 diff --git a/src/gw_backend.c b/src/gw_backend.c
14 index dbef6328..7b5ef190 100644
15 --- a/src/gw_backend.c
16 +++ b/src/gw_backend.c
17 @@ -1399,8 +1399,12 @@ int gw_set_defaults_backend(server *srv, gw_plugin_data *p, data_unset *du, size
18                      host->port = 80;
19                  }
20  
21 -                host->family = (!buffer_string_is_empty(host->host)
22 -                                && NULL != strchr(host->host->ptr, ':'))
23 +                if (buffer_string_is_empty(host->host)) {
24 +                    buffer_copy_string_len(host->host,
25 +                                           CONST_STR_LEN("127.0.0.1"));
26 +                }
27 +
28 +                host->family = (NULL != strchr(host->host->ptr, ':'))
29                    ? AF_INET6
30                    : AF_INET;
31              }