summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 16:03:35 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 16:03:35 +0200
commit5b84593e78927b716da4b65c95ef92aabdf4c548 (patch)
tree056b3fa8c1cccfa5a9e7e24f4e0d5251351c88ec
parent6b639da8423aa40217f58684644f5fc8ea2c1e1a (diff)
downloadmblaze-5b84593e78927b716da4b65c95ef92aabdf4c548.tar.gz
mblaze-5b84593e78927b716da4b65c95ef92aabdf4c548.tar.xz
mblaze-5b84593e78927b716da4b65c95ef92aabdf4c548.zip
blaze822: fix blaze822_mem body start
-rw-r--r--blaze822.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/blaze822.c b/blaze822.c
index 79b1a23..8934844 100644
--- a/blaze822.c
+++ b/blaze822.c
@@ -347,11 +347,16 @@ blaze822_mem(char *src, size_t len)
 	if (!mesg)
 		return 0;
 
-	end = memmem(src, len, "\n\n", 2);
-	if (!end)
-		end = memmem(src, len, "\r\n\r\n", 4);
-	if (!end)
+	if ((end = memmem(src, len, "\n\n", 2))) {
+		mesg->body = end+2;
+	} else if ((end = memmem(src, len, "\r\n\r\n", 4))) {
+		mesg->body = end+4;
+	} else {
 		end = src + len;
+		mesg->body = 0;
+	}
+	if (mesg->body)
+		mesg->bodyend = src + len;
 
 	size_t hlen = end - src;
 
@@ -367,8 +372,6 @@ blaze822_mem(char *src, size_t len)
 
 	mesg->msg = buf;
 	mesg->end = end;
-	mesg->body = src + hlen;
-	mesg->bodyend = src + len;
 	mesg->bodychunk = 0;   // src is not ours
 
 	return mesg;