summaryrefslogtreecommitdiff
path: root/networking/httpd_indexcgi.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-09-10 21:24:45 +0200
committerDenys Vlasenko2009-09-10 21:24:45 +0200
commitdb4a67628d4e4418d01bbba1c8603a6ca8c3562e (patch)
treef45e2f496d7d7c999dbfb03141ce084d2569f425 /networking/httpd_indexcgi.c
parent33d8d08f7818a6d10e14ad8397c61adfcd377a6f (diff)
downloadbusybox-db4a67628d4e4418d01bbba1c8603a6ca8c3562e.zip
busybox-db4a67628d4e4418d01bbba1c8603a6ca8c3562e.tar.gz
networking/httpd_ssi.c: new example CGI handler
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/httpd_indexcgi.c')
-rw-r--r--networking/httpd_indexcgi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/httpd_indexcgi.c b/networking/httpd_indexcgi.c
index 94c6a69..2605ad1 100644
--- a/networking/httpd_indexcgi.c
+++ b/networking/httpd_indexcgi.c
@@ -28,7 +28,8 @@ httpd_indexcgi.c -o index.cgi
/* We don't use printf, as it pulls in >12 kb of code from uclibc (i386). */
/* Currently malloc machinery is the biggest part of libc we pull in. */
/* We have only one realloc and one strdup, any idea how to do without? */
-/* Size (i386, approximate):
+
+/* Size (i386, static uclibc, approximate):
* text data bss dec hex filename
* 13036 44 3052 16132 3f04 index.cgi
* 2576 4 2048 4628 1214 index.cgi.o
@@ -210,7 +211,7 @@ static void fmt_04u(/*char *dst,*/ unsigned n)
fmt_02u(n % 100);
}
-int main(void)
+int main(int argc, char *argv[])
{
dir_list_t *dir_list;
dir_list_t *cdir;
@@ -225,6 +226,7 @@ int main(void)
QUERY_STRING = getenv("QUERY_STRING");
if (!QUERY_STRING
|| QUERY_STRING[0] != '/'
+ || strstr(QUERY_STRING, "//")
|| strstr(QUERY_STRING, "/../")
|| strcmp(strrchr(QUERY_STRING, '/'), "/..") == 0
) {