The following reply was made to PR user/6515; it has been noted by GNATS. From: =?ISO-8859-1?Q?Bj=F6rn_Ketelaars?= <bjorn.ketelaars@hydroxide.nl> To: gnats@cvs.openbsd.org, bugs@cvs.openbsd.org Cc: Jasper Lievisse Adriaanse <jasper@humppa.nl> Subject: Re: user/6515: fix for pr6009 creates a new problem Date: Tue, 4 Jan 2011 14:48:43 +0100 On Thu, Nov 25, 2010 at 12:25 PM, <gnats@cvs.openbsd.org> 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: =A0 =A0 =A0 user > >Responsible: =A0 =A0bugs > >Synopsis: =A0 =A0 =A0 fix for pr6009 creates a new problem > >Arrival-Date: =A0 Thu Nov 25 11:20:01 GMT 2010 On Tue, Jan 4, 2011 at 12:11 PM, Jasper Lievisse Adriaanse <jasper@humppa.nl>=A0wrote: > > Hi, > > I can't recall the exact reason as to why we committed a different fix, b= ut > most likely because atoi() usage should be avoided. Please resend the dif= f but > with using strtonum() instead. > > Cheers, > Jasper As requested by Jasper a new diff using strtonum(). Index: proxy_http.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D r->server->module_config; proxy_server_conf *conf =3D @@ -367,7 +369,11 @@ AP_HOOK_DECLINE(DECLINED), &rc, r, f, desthost, destportstr, destportstr); if (rc =3D=3D DECLINED) { - if (destportstr !=3D NULL && destport !=3D DEFAULT_HTTP_PORT) + destportstrtonum =3D strtonum(destportstr, 0, 65535, &errstr); + if (errstr) + errx(1, "The destination port is %s: %s", errstr, destportstr); + + if (destportstr !=3D NULL && destportstrtonum !=3D destport) ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL); else ap_bvputs(f, "Host: ", desthost, CRLF, NULL);
