comparison libpurple/protocols/simple/simple.c @ 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 61f825f8b3a2
children dea69e5e3427 9bdd3ab8087f adf153852bcf
comparison
equal deleted inserted replaced
24442:71cf42ff1a6f 24443:7d07bb66f70b
1628 time_t currtime = time(NULL); 1628 time_t currtime = time(NULL);
1629 cur += 2; 1629 cur += 2;
1630 cur[0] = '\0'; 1630 cur[0] = '\0';
1631 purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), conn->inbuf); 1631 purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), conn->inbuf);
1632 msg = sipmsg_parse_header(conn->inbuf); 1632 msg = sipmsg_parse_header(conn->inbuf);
1633
1634 if(!msg) {
1635 /* Should we re-use this error message (from lower in the function)? */
1636 purple_debug_misc("simple", "received a incomplete sip msg: %s\n", conn->inbuf);
1637 return;
1638 }
1639
1633 cur[0] = '\r'; 1640 cur[0] = '\r';
1634 cur += 2; 1641 cur += 2;
1635 restlen = conn->inbufused - (cur - conn->inbuf); 1642 restlen = conn->inbufused - (cur - conn->inbuf);
1636 if(restlen >= msg->bodylen) { 1643 if(restlen >= msg->bodylen) {
1637 dummy = g_malloc(msg->bodylen + 1); 1644 dummy = g_malloc(msg->bodylen + 1);