Module: sip-router
Branch: master
Commit: da381afeb44cbbb470c9bdc944a6169f8937e9aa
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=da381af…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Aug 30 19:15:52 2010 +0200
core: better condition for shifting back chunk payloads
---
tcp_read.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tcp_read.c b/tcp_read.c
index c71949b..e152f5b 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -744,7 +744,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
if (r->bytes_to_go==0){
r->state = H_HTTP11_CHUNK_END;
/* shift back body content */
- if(p-r->chunk_size>0) {
+ if(r->chunk_size>0 && p-r->chunk_size>r->body) {
memcpy(r->body + r->content_len, p - r->chunk_size,
r->chunk_size);
r->content_len += r->chunk_size;