summaryrefslogtreecommitdiff
path: root/sapi/cgi/cgi_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-rw-r--r--sapi/cgi/cgi_main.c13
1 files changed, 12 insertions, 1 deletions
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);