diff libpurple/protocols/msn/msg.c @ 27906:6ecfc6b9667c

propagate from branch 'im.pidgin.pidgin' (head ca4b6e987b967927b0f8bd001bc33440a6885000) to branch 'im.pidgin.pidgin.yaz' (head 7a92169e2ac82026d2b2918ed9662c7fd42e3280)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 17 Nov 2008 06:15:33 +0000
parents 7cda79469830 7e8175f9b009
children a959b17ffc57
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c	Fri Oct 31 08:37:42 2008 +0000
+++ b/libpurple/protocols/msn/msg.c	Mon Nov 17 06:15:33 2008 +0000
@@ -195,8 +195,9 @@
 
 	if (body_len > 0) {
 		msg->body_len = len - (tmp - body);
-		msg->body = g_malloc0(msg->body_len + 1);
+		msg->body = g_malloc(msg->body_len + 1);
 		memcpy(msg->body, tmp, msg->body_len);
+		msg->body[msg->body_len] = '\0';
 		tmp += body_len;
 	}
 }
@@ -212,8 +213,9 @@
 	char **elems, **cur, **tokens;
 
 	g_return_if_fail(payload != NULL);
-	tmp_base = tmp = g_malloc0(payload_len + 1);
+	tmp_base = tmp = g_malloc(payload_len + 1);
 	memcpy(tmp_base, payload, payload_len);
+	tmp_base[payload_len] = '\0';
 
 	/* Parse the attributes. */
 	end = strstr(tmp, body_dem);
@@ -311,8 +313,9 @@
 		if (body_len > 0) {
 			msg->body_len = body_len;
 			g_free(msg->body);
-			msg->body = g_malloc0(msg->body_len + 1);
+			msg->body = g_malloc(msg->body_len + 1);
 			memcpy(msg->body, tmp, msg->body_len);
+			msg->body[msg->body_len] = '\0';
 			tmp += body_len;
 		}
 
@@ -328,8 +331,9 @@
 		if (payload_len - (tmp - tmp_base) > 0) {
 			msg->body_len = payload_len - (tmp - tmp_base);
 			g_free(msg->body);
-			msg->body = g_malloc0(msg->body_len + 1);
+			msg->body = g_malloc(msg->body_len + 1);
 			memcpy(msg->body, tmp, msg->body_len);
+			msg->body[msg->body_len] = '\0';
 		}
 	}
 
@@ -526,8 +530,9 @@
 
 	if (data != NULL && len > 0)
 	{
-		msg->body = g_malloc0(len + 1);
+		msg->body = g_malloc(len + 1);
 		memcpy(msg->body, data, len);
+		msg->body[len] = '\0';
 		msg->body_len = len;
 	}
 	else