Browse code

core: better condition for shifting back chunk payloads

Daniel-Constantin Mierla authored on 30/08/2010 17:15:52
Showing 1 changed files
... ...
@@ -744,7 +744,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
744 744
 				if (r->bytes_to_go==0){
745 745
 					r->state = H_HTTP11_CHUNK_END;
746 746
 					/* shift back body content */
747
-					if(p-r->chunk_size>0) {
747
+					if(r->chunk_size>0 && p-r->chunk_size>r->body) {
748 748
 						memcpy(r->body + r->content_len, p - r->chunk_size,
749 749
 								r->chunk_size);
750 750
 						r->content_len += r->chunk_size;