From: Dmitry Stogov Date: Thu, 23 Mar 2006 10:15:01 +0000 (+0000) Subject: Allowed '-b' with UNIX sockets: X-Git-Tag: php-5.1.3RC2~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c1b4f45eb4a8116536aa5b44b3891b024f73e47;p=php Allowed '-b' with UNIX sockets: -b : -b -b --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 193506a346..c9e3317ee6 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -921,6 +921,17 @@ void fastcgi_cleanup(int signal) } #endif +static int is_port_number(const char *bindpath) +{ + while (*bindpath) { + if (*bindpath < '0' || *bindpath > '9') { + return 0; + } + bindpath++; + } + return 1; +} + /* {{{ main */ int main(int argc, char *argv[]) @@ -1147,7 +1158,7 @@ consult the installation file that came with this distribution, or visit \n\ * path (it's what the fastcgi library expects) */ - if (strchr(bindpath, ':') == NULL) { + if (strchr(bindpath, ':') == NULL && is_port_number(bindpath)) { char *tmp; tmp = malloc(strlen(bindpath) + 2);