From ea16273623bb5090487a990f4f59f77f194aa1b5 Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 4 Mar 2012 15:53:51 +0000 Subject: [PATCH] [package] uhttpd: cope with variable number of spaces in header lines (#11079) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30806 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/uhttpd/Makefile | 4 ++-- package/uhttpd/src/uhttpd.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package/uhttpd/Makefile b/package/uhttpd/Makefile index e0e567af4..5688073ad 100644 --- a/package/uhttpd/Makefile +++ b/package/uhttpd/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2011 Jo-Philipp Wich +# Copyright (C) 2010-2012 Jo-Philipp Wich # # 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 := \ diff --git a/package/uhttpd/src/uhttpd.c b/package/uhttpd/src/uhttpd.c index 3563d91d1..9b9608628 100644 --- a/package/uhttpd/src/uhttpd.c +++ b/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 */