On Thu, Nov 25, 2010 at 12:25 PM, <[email protected]> wrote:
>
> Thank you very much for your problem report.
> It has the internal identification `user/6515'.
> The individual assigned to look at your
> report is: bugs.
>
> >Category:       user
> >Responsible:    bugs
> >Synopsis:       fix for pr6009 creates a new problem
> >Arrival-Date:   Thu Nov 25 11:20:01 GMT 2010

On Tue, Jan 4, 2011 at 12:11 PM, Jasper Lievisse Adriaanse
<[email protected]> wrote:
>
> Hi,
>
> I can't recall the exact reason as to why we committed a different fix, but
> most likely because atoi() usage should be avoided. Please resend the diff
but
> with using strtonum() instead.
>
> Cheers,
> Jasper


As requested by Jasper a new diff using strtonum().

Index: proxy_http.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/modules/proxy/proxy_http.c,v
retrieving revision 1.21
diff -u -r1.21 proxy_http.c
--- proxy_http.c        25 Feb 2010 07:53:07 -0000      1.21
+++ proxy_http.c        4 Jan 2011 13:33:23 -0000
@@ -169,6 +169,8 @@
     int result, major, minor;
     const char *content_length;
     const char *peer;
+    int destportstrtonum;
+    const char *errstr;

     void *sconf = r->server->module_config;
     proxy_server_conf *conf =
@@ -367,7 +369,11 @@
                    AP_HOOK_DECLINE(DECLINED),
                    &rc, r, f, desthost, destportstr, destportstr);
         if (rc == DECLINED) {
-           if (destportstr != NULL && destport != DEFAULT_HTTP_PORT)
+           destportstrtonum = strtonum(destportstr, 0, 65535, &errstr);
+           if (errstr)
+               errx(1, "The destination port is %s: %s", errstr, destportstr);
+
+           if (destportstr != NULL && destportstrtonum != destport)
                ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL);
            else
                ap_bvputs(f, "Host: ", desthost, CRLF, NULL);

Reply via email to