summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-03-19 13:32:24 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-03-19 13:32:24 +0000
commit008fbe53e3cfb0984ff7521ccb3ea8d568876e06 (patch)
tree3c4ea51c2ccf3562dec401d1ceee3066bb00e837
parent42d15c0e27b62c8a7a154837c8d6ce920219ea3e (diff)
uhttpd: accept wrongly terminated cgi headers, needed for X-Wrt
-rw-r--r--contrib/package/uhttpd/src/uhttpd-cgi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-cgi.c b/contrib/package/uhttpd/src/uhttpd-cgi.c
index 2a9fdc9e1..93caf5add 100644
--- a/contrib/package/uhttpd/src/uhttpd-cgi.c
+++ b/contrib/package/uhttpd/src/uhttpd-cgi.c
@@ -12,9 +12,10 @@ static struct http_response * uh_cgi_header_parse(char *buf, int len, int *off)
static struct http_response res;
- if( (bufptr = strfind(buf, len, "\r\n\r\n", 4)) != NULL )
- {
- *off = (int)(bufptr - buf) + 4;
+ if( ((bufptr = strfind(buf, len, "\r\n\r\n", 4)) != NULL) ||
+ ((bufptr = strfind(buf, len, "\n\n", 2)) != NULL)
+ ) {
+ *off = (int)(bufptr - buf) + ((bufptr[1] == '\r') ? 4 : 2);
memset(&res, 0, sizeof(res));