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

Peter Korsgaard jacmet at sunsite.dk
Fri Dec 16 08:08:58 UTC 2011


>>>>> "Denys" == Denys Vlasenko <vda.linux at googlemail.com> writes:

 >> The memory pointed to by g_query gets overwritten when the index_page
 >> is used,

 Denys> Where exactly this happens? Here? -

 Denys>         if (urlp[-1] == '/')
 Denys>                 strcpy(urlp, index_page);

Yes, If you use the /?blah -> /cgi-bin/index.cgi?blah translation, the
URL arguments gets overwritten by the first /?blah -> /index_page
translation.

You probably noticed it when you added it back in 2006, as you updated
urlp / g_query to set it to the empty string rather than "ndex.html".

 Denys> Better comment?

 Denys> When "index.html" string is appended to ...dir/ URL, it writes over
 Denys> query string. If we later call index.cgi, query string would be lost
 Denys> and not available to that CGI. ...

Ok, will update and resend.

 >> +		g_query = alloca(strlen(tptr) + 1);
 >> +		strcpy((char *)g_query, tptr);
 >> +#else
 >> g_query = tptr;
 >> +#endif

 Denys> Let's just use xstrcpy().

I don't see any xstrcpy in busybox. Did you perhaps mean xstrdup or
strdupa?

-- 
Bye, Peter Korsgaard


More information about the busybox mailing list