You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Eric Cholet <ch...@logilune.com> on 2001/04/24 20:56:11 UTC

[PATCH] 1.3 segfault

Hi,

Running 1.3 on a misconfigured box I get a segfault fixed
by this patch:

--- util.c.orig Thu Feb  1 11:06:37 2001
+++ util.c      Tue Apr 24 21:58:17 2001
@@ -2048,7 +2048,7 @@
         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 */

--
Eric Cholet
B995 E519 1594 10D0 4271 1EA5 8DF3 8004

Re: [PATCH] 1.3 segfault

Posted by Eric Cholet <ch...@logilune.com>.
--On 24/04/01 15:21 -0400 Cliff Woolley wrote:
> This is a bug in 1.3.19, but it's been fixed in CVS for a while now.  In
> fact, the current version tests it one further, doing this:
>
> if (p && p->h_addr_list && p->h_addr_list[0])
>

cool, thanks.

--
Eric Cholet
B995 E519 1594 10D0 4271 1EA5 8DF3 8004

Re: [PATCH] 1.3 segfault

Posted by Cliff Woolley <cl...@yahoo.com>.
On Tue, 24 Apr 2001, Eric Cholet wrote:

> Running 1.3 on a misconfigured box I get a segfault fixed
> by this patch:
>
> --- util.c.orig Thu Feb  1 11:06:37 2001
> +++ util.c      Tue Apr 24 21:58:17 2001
> @@ -2048,7 +2048,7 @@
>          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 */
>

This is a bug in 1.3.19, but it's been fixed in CVS for a while now.  In
fact, the current version tests it one further, doing this:

if (p && p->h_addr_list && p->h_addr_list[0])

Thanks,
Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA