uhttpd: break tight loop when receiving eof during header reading (#7904)
[openwrt/staging/yousong.git] / package / uhttpd / src / uhttpd.c
index 6f5e616345121205a0a4fb4a93daaaab33108854..a818e1c4507e58ff55f501b7bb28a7462df57e45 100644 (file)
@@ -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;
                        }