www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Franz Korntner <fr...@hippo.xs4all.nl>
Subject general/7573: SIGSEGV fault for non existent hostname in ap_get_local_host()
Date Mon, 16 Apr 2001 20:18:31 GMT

>Number:         7573
>Category:       general
>Synopsis:       SIGSEGV fault for non existent hostname in ap_get_local_host()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Apr 16 13:20:01 PDT 2001
>Originator:     franz@hippo.xs4all.nl
>Release:        1.3.19
Linux 2.2.19
My machine has a non existing hostname (not present in /etc/hosts and DNS) 
and wil SIGSEGV in routine ap_get_local_host().

In this routine the functions gethostbyname() and find_fqdn() are called and 
will both return a NULL pointer. The code will then try to dereference the NULL
pointer causing the violation.
1) Set the machine hostname to a name not present in /etc/hosts and DNS
2) start httpd
--- ./src/main/util.c.old       Mon Apr 16 22:01:33 2001
+++ ./src/main/util.c   Mon Apr 16 22:02:28 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 */
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]

View raw message