changeset 24443:7d07bb66f70b

Add a NULL check to fix a crash. Fixes #4516. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Richard Laager <rlaager@wiktel.com>
date Mon, 24 Nov 2008 00:01:27 +0000
parents 71cf42ff1a6f
children 168329be9623
files libpurple/protocols/simple/simple.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c	Sun Nov 23 23:16:02 2008 +0000
+++ b/libpurple/protocols/simple/simple.c	Mon Nov 24 00:01:27 2008 +0000
@@ -1630,6 +1630,13 @@
 		cur[0] = '\0';
 		purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), conn->inbuf);
 		msg = sipmsg_parse_header(conn->inbuf);
+
+		if(!msg) {
+			/* Should we re-use this error message (from lower in the function)? */
+			purple_debug_misc("simple", "received a incomplete sip msg: %s\n", conn->inbuf);
+			return;
+		}
+
 		cur[0] = '\r';
 		cur += 2;
 		restlen = conn->inbufused - (cur - conn->inbuf);