What steps will reproduce the problem?
1. CGI script exists at /script.cgi
2. Repeatedly query URLs containing the CGI script, e.g /script.cgi/test.html
3. Actual PATH_INFO given to the script may end in garbage
What is the expected output? What do you see instead?
Expect PATH_INFO to be set to "/test.html". Instead, it may end in random
characters such as "/test.htmlimages/titleBar.png".
What version of the product are you using? On what operating system?
Mongoose version 3.1 on linux
Please provide any additional information below.
In mongoose.c convert_uri_to_filename(), the null terminator needs to be copied
along with the path_info string. The following patch seems to fix it:
@@ -1596,7 +1596,7 @@
strlen(conn->ctx->config[CGI_EXTENSIONS]), buf) > 0 &&
(stat_result = mg_stat(buf, st)) == 0) {
conn->path_info = p + 1;
- memmove(p + 2, p + 1, strlen(p + 1));
+ memmove(p + 2, p + 1, strlen(p + 1) + 1);
p[1] = '/';
break;
} else {
Original issue reported on code.google.com by Brian.Ha...@gmail.com on 14 Mar 2012 at 8:47
Original issue reported on code.google.com by
Brian.Ha...@gmail.com
on 14 Mar 2012 at 8:47