From: Martin Kraemer Date: Tue, 13 Mar 2001 10:22:21 +0000 (+0000) Subject: Ignasi writes,... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36686f07cb33705284001b39f7bbb317aead7c73;p=thirdparty%2Fapache%2Fhttpd.git Ignasi writes,... The first correction is not important, only removes a redundant line, the ap_pstrdup(a, "127.0.0.1") is done anyway at the end of the function. The second correction is really a bug the p-> can be NULL. Submitted by: "Roca Carrio, Ignasi" git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@88509 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/CHANGES b/src/CHANGES index 9899ae1e656..8c26c10a248 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 1.3.20 + *) Fix a possible NULL pointer dereference in the detection of the + default ServerName or IP string (introduced in 1.3.18). + [Ignasi Roca, ] + *) Make EBCDIC conversion fully configurable. Until now, apache relied on some (incomplete) heuristics, and would fail to correctly serve text files when they had a MIME type of application/anything, like diff --git a/src/main/util.c b/src/main/util.c index fb3347f96c4..8c056f06c82 100644 --- a/src/main/util.c +++ b/src/main/util.c @@ -2040,7 +2040,6 @@ char *ap_get_local_host(pool *a) 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,7 +2047,7 @@ char *ap_get_local_host(pool *a) 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[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 */