[PATCH] httpd: don't drop QUERY_STRING when /cgi-bin/index.cgi is used
Denys Vlasenko
vda.linux at googlemail.com
Fri Dec 16 00:34:13 UTC 2011
On Thursday 15 December 2011 16:44, Peter Korsgaard wrote:
> The memory pointed to by g_query gets overwritten when the index_page
> is used,
Where exactly this happens? Here? -
if (urlp[-1] == '/')
strcpy(urlp, index_page);
> causing URL arguments to get dropped when we fall back to
> /cgi-bin/index.cgi.
>
> Work around it by making g_query a deep copy of urlp when CGI support
> is enabled, rather than silently dropping them.
> +#if ENABLE_FEATURE_HTTPD_CGI
> + /* tptr gets overwritten by index_page, so do deep copy
> + for /cgi-bin/index.cgi */
Better comment?
When "index.html" string is appended to ...dir/ URL, it writes over
query string. If we later call index.cgi, query string would be lost
and not available to that CGI. ...
> + g_query = alloca(strlen(tptr) + 1);
> + strcpy((char *)g_query, tptr);
> +#else
> g_query = tptr;
> +#endif
Let's just use xstrcpy().
Please send patch v2.
--
vda
More information about the busybox
mailing list