Date: Fri, 30 Mar 2001 19:43:37 -0600 (CST) From: "Scot W. Hetzel" <hetzels@westbend.net> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/26237: Apache 1.3.19 segfaulting in ap_get_local_host Message-ID: <200103310143.f2V1hbx63919@mail.westbend.net>
next in thread | raw e-mail | index | archive | help
>Number: 26237 >Category: ports >Synopsis: Apache 1.3.19 segfaulting in ap_get_local_host >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 30 17:50:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Scot W. Hetzel >Release: FreeBSD 4.2-STABLE i386 >Organization: West Bend Internet >Environment: >Description: Apache Segfaults in ap_get_local_host when ServerName directive is not defined in httpd.conf. >How-To-Repeat: Install apache13, apache13+ipv6, or apache13-modssl and remove the ServerName directive from httpd.conf. >Fix: place the following patch as files/patch-util.c in the apache13, apache13+ipv6, and apache13-modssl ports. apache13-fp is not affected as a similar patch was added a week ago. apache13-ssl < 1.3.19. This patch was obtained from the Apache cvsweb site: http://www.apache.org/websrc/viewcvs.cgi/apache-1.3/src/main/util.c.diff?r1=text&tr1=1.194&r2=text&tr2=1.197&diff_format=u NOTE: Could one of the commiters add this patch before 4.3-RELEASE I have informed the other Apache13* maintainers on this problem, and will inform them of this PR also. --- src/main/util.c 2001/02/01 10:06:37 1.194 +++ src/main/util.c 2001/03/30 17:37:54 1.197 @@ -2013,12 +2013,14 @@ int x; if (!strchr(p->h_name, '.')) { - for (x = 0; p->h_aliases[x]; ++x) { - if (strchr(p->h_aliases[x], '.') && - (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name)))) - return ap_pstrdup(a, p->h_aliases[x]); - } - return NULL; + if (p->h_aliases) { + for (x = 0; p->h_aliases[x]; ++x) { + if (p->h_aliases[x] && strchr(p->h_aliases[x], '.') && + (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name)))) + return ap_pstrdup(a, p->h_aliases[x]); + } + } + return NULL; } return ap_pstrdup(a, (void *) p->h_name); } @@ -2040,7 +2042,6 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, "%s: gethostname() failed to determine ServerName\n", ap_server_argv0); - server_hostname = ap_pstrdup(a, "127.0.0.1"); } else { @@ -2048,14 +2049,14 @@ if ((!(p = gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) { /* Recovery - return the default servername by IP: */ - if (p->h_addr_list[0]) { + if (p && p->h_addr_list && p->h_addr_list[0]) { ap_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]); server_hostname = ap_pstrdup(a, str); /* We will drop through to report the IP-named server */ } } else - /* Since we found a fdqn, return it with no logged message. */ + /* Since we found a fqdn, return it with no logged message. */ return server_hostname; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103310143.f2V1hbx63919>