Преглед изворни кода

uhttpd: cope with variable number of spaces in header lines (#11079)

SVN-Revision: 30806
Jo-Philipp Wich пре 14 година
родитељ
комит
8533636d2d
2 измењених фајлова са 8 додато и 5 уклоњено
  1. 2 2
      package/uhttpd/Makefile
  2. 6 3
      package/uhttpd/src/uhttpd.c

+ 2 - 2
package/uhttpd/Makefile

@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2010-2011 Jo-Philipp Wich <[email protected]>
+# Copyright (C) 2010-2012 Jo-Philipp Wich <[email protected]>
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=30
+PKG_RELEASE:=31
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 PKG_CONFIG_DEPENDS := \

+ 6 - 3
package/uhttpd/src/uhttpd.c

@@ -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 */