diff src/protocols/msn/directconn.c @ 10899:1e6bdc7175e9

[gaim-migrate @ 12619] Bits'n'pieces: Don't allow gaim-remote "clones" to knock gaim out by specifying a big packet length. Correctly bound the point sizes in gtkimhtml & yahoo Fix up some code in MSN that isn't actually being used, just in case someone comes along and submits a patch that would use it. Don't try writing to the server in MSN if you're not actually connected Fix message flags in SILC committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 05 May 2005 13:09:28 +0000
parents 0f7452b1f777
children fc464a0abccc
line wrap: on
line diff
--- a/src/protocols/msn/directconn.c	Tue May 03 04:40:53 2005 +0000
+++ b/src/protocols/msn/directconn.c	Thu May 05 13:09:28 2005 +0000
@@ -315,12 +315,20 @@
 		return;
 	}
 
-	body = g_malloc(body_len);
+	body = g_try_malloc(body_len);
+
+	if (body != NULL)
+	{
+		/* Let's read the data. */
+		len = read(directconn->fd, body, body_len);
 
-	/* Let's read the data. */
-	len = read(directconn->fd, body, body_len);
-
-	gaim_debug_info("msn", "len=%d\n", len);
+		gaim_debug_info("msn", "len=%d\n", len);
+	}
+	else
+	{
+		gaim_debug_error("msn", "Failed to allocate memory for read\n");
+		len = 0;
+	}
 
 	if (len > 0)
 	{