From: Brian Havard Date: Mon, 25 Oct 1999 12:45:39 +0000 (+0000) Subject: Make args to CGIs work. X-Git-Tag: 1.3.10~226 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=010eb1291c30840af4d3ea8bba64faadf6043440;p=apache Make args to CGIs work. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84033 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index b7dbbecd24..ef549531ea 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -373,7 +373,7 @@ static ap_status_t run_cgi_child(BUFF **script_out, BUFF **script_in, BUFF **scr ap_unblock_alarms(); return (rc); } -static ap_status_t build_argv_list(char *argv[], request_rec *r, ap_context_t *p) +static ap_status_t build_argv_list(char ***argv, request_rec *r, ap_context_t *p) { int numwords, x, idx; char *w; @@ -392,14 +392,14 @@ static ap_status_t build_argv_list(char *argv[], request_rec *r, ap_context_t *p if (numwords > APACHE_ARG_MAX) { numwords = APACHE_ARG_MAX; /* Truncate args to prevent overrun */ } - argv = (char **) ap_palloc(p, (numwords + 1) * sizeof(char *)); + *argv = (char **) ap_palloc(p, (numwords + 1) * sizeof(char *)); for (x = 1, idx = 0; x <= numwords; x++) { w = ap_getword_nulls(p, &args, '+'); ap_unescape_url(w); - argv[idx++] = ap_escape_shell_cmd(p, w); + (*argv)[idx++] = ap_escape_shell_cmd(p, w); } - argv[idx] = NULL; + (*argv)[idx] = NULL; } return APR_SUCCESS; @@ -444,7 +444,7 @@ static int cgi_handler(request_rec *r) int retval, nph, dbpos = 0; char *argv0, *dbuf = NULL; char *command; - char *argv = NULL; + char **argv = NULL; BUFF *script_out = NULL, *script_in = NULL, *script_err = NULL; char argsbuffer[HUGE_STRING_LEN]; @@ -527,7 +527,7 @@ static int cgi_handler(request_rec *r) return HTTP_INTERNAL_SERVER_ERROR; } /* run the script in its own process */ - else if (run_cgi_child(&script_out, &script_in, &script_err, command, &argv, r, p) != APR_SUCCESS) { + else if (run_cgi_child(&script_out, &script_in, &script_err, command, argv, r, p) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, "couldn't spawn child process: %s", r->filename); return HTTP_INTERNAL_SERVER_ERROR;