[package] uhttpd: cope with variable number of spaces in header lines (#11079)
[openwrt/svn-archive/archive.git] / package / uhttpd / src / uhttpd.c
index 3563d91d16ef92ad12ed55cae69b410cc5aa2e84..9b9608628d4d393dc654bfbe966d5bdc17cb48a7 100644 (file)
@@ -337,11 +337,14 @@ static struct http_request * uh_http_header_parse(struct client *cl, char *buffe
                        }
 
                        /* have name but no value and found a colon, start of value */
-                       else if( hdrname && !hdrdata && ((i+2) < buflen) &&
-                               (buffer[i] == ':') && (buffer[i+1] == ' ')
+                       else if( hdrname && !hdrdata &&
+                           ((i+1) < buflen) && (buffer[i] == ':')
                        ) {
                                buffer[i] = 0;
-                               hdrdata = &buffer[i+2];
+                               hdrdata = &buffer[i+1];
+
+                               while ((hdrdata + 1) < (buffer + buflen) && *hdrdata == ' ')
+                                       hdrdata++;
                        }
 
                        /* have no name and found [A-Za-z], start of name */