Browse Source

uhttpd: break tight loop when receiving eof during header reading (#7904)

SVN-Revision: 22988
Jo-Philipp Wich 15 years ago
parent
commit
70dff7070e
2 changed files with 5 additions and 1 deletions
  1. 1 1
      package/uhttpd/Makefile
  2. 4 0
      package/uhttpd/src/uhttpd.c

+ 1 - 1
package/uhttpd/Makefile

@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uhttpd
-PKG_RELEASE:=17
+PKG_RELEASE:=18
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 PKG_BUILD_DEPENDS := libcyassl liblua

+ 4 - 0
package/uhttpd/src/uhttpd.c

@@ -401,6 +401,10 @@ static struct http_request * uh_http_header_recv(struct client *cl)
 			{
 				ensure_out(rlen = uh_tcp_recv(cl, bufptr, rlen));
 
+				/* unexpected eof - #7904 */
+				if( rlen == 0 )
+					return NULL;
+
 				blen -= rlen;
 				bufptr += rlen;
 			}