[PATCH] httpd: don't drop QUERY_STRING when /cgi-bin/index.cgi is used

Paulius Zaleckas paulius.zaleckas at gmail.com
Thu Dec 15 16:05:22 UTC 2011


On 12/15/2011 05:50 PM, Paulius Zaleckas wrote:
 > On 12/15/2011 05:44 PM, Peter Korsgaard wrote:
 >> The memory pointed to by g_query gets overwritten when the index_page
 >> is used, 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.
 >>
 >> Signed-off-by: Peter Korsgaard<jacmet at sunsite.dk>
 >> ---
 >> networking/httpd.c | 9 +++++++--
 >> 1 files changed, 7 insertions(+), 2 deletions(-)
 >>
 >> diff --git a/networking/httpd.c b/networking/httpd.c
 >> index 0356e4c..37d6577 100644
 >> --- a/networking/httpd.c
 >> +++ b/networking/httpd.c
 >> @@ -1996,7 +1996,14 @@ static void handle_incoming_and_exit(const
 >> len_and_sockaddr *fromAddr)
 >> tptr = strchr(urlcopy, '?');
 >> if (tptr) {
 >> *tptr++ = '\0';
 >> +#if ENABLE_FEATURE_HTTPD_CGI
 >> + /* tptr gets overwritten by index_page, so do deep copy
 >> + for /cgi-bin/index.cgi */
 >> + g_query = alloca(strlen(tptr) + 1);
 >> + strcpy((char *)g_query, tptr);
 >
 > Why not use strdup() instead?

xstrdup() actually.


More information about the busybox mailing list