On Tue, Jun 28, 2022 at 9:06 AM <gbec...@apache.org> wrote:
>
> Author: gbechis
> Date: Tue Jun 28 13:06:55 2022
> New Revision: 1902318
>
> URL: http://svn.apache.org/viewvc?rev=1902318&view=rev
> Log:
> check apr_sockaddr_info_get return value
> bz #66136
>
> Modified:
>     httpd/httpd/trunk/docs/log-message-tags/next-number
>     httpd/httpd/trunk/server/listen.c
>
> Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1902318&r1=1902317&r2=1902318&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
> +++ httpd/httpd/trunk/docs/log-message-tags/next-number Tue Jun 28 13:06:55 
> 2022
> @@ -1 +1 @@
> -10397
> +10398
>
> Modified: httpd/httpd/trunk/server/listen.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/listen.c?rev=1902318&r1=1902317&r2=1902318&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/listen.c (original)
> +++ httpd/httpd/trunk/server/listen.c Tue Jun 28 13:06:55 2022
> @@ -881,7 +881,12 @@ AP_DECLARE(apr_status_t) ap_duplicate_li
>                  duplr->protocol = apr_pstrdup(p, lr->protocol);
>                  hostname = apr_pstrdup(p, lr->bind_addr->hostname);
>                  port = lr->bind_addr->port;
> -                apr_sockaddr_info_get(&sa, hostname, APR_UNSPEC, port, 0, p);
> +                stat = apr_sockaddr_info_get(&sa, hostname, APR_UNSPEC, 
> port, 0, p);
> +                if (stat != APR_SUCCESS) {
> +                    ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, 
> APLOGNO(10397)
> +                              "unable to control socket status");
> +                    return stat;
> +                }

Better message here (even though it's unlikely anyone will ever see it)?  e.g.

Index: server/listen.c
===================================================================
--- server/listen.c (revision 1902318)
+++ server/listen.c (working copy)
@@ -884,7 +884,7 @@
                 stat = apr_sockaddr_info_get(&sa, hostname,
APR_UNSPEC, port, 0, p);
                 if (stat != APR_SUCCESS) {
                     ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p,
APLOGNO(10397)
-                              "unable to control socket status");
+                              "failure looking up %s to duplicate
listening socket", hostname);
                     return stat;
                 }
                 duplr->bind_addr = sa;

Reply via email to