... | ... |
@@ -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; |