qulogic/pidgin

Ignore incoming sip messages with bodies longer than 30 MB.
release-2.x.y
2014-01-11, Mark Doliner
179a49ea2a4b
Parents dfe26ea283ee
Children 4e2416683223
Ignore incoming sip messages with bodies longer than 30 MB.
--- a/libpurple/protocols/simple/sipmsg.c Sat Jan 11 21:43:32 2014 -0800
+++ b/libpurple/protocols/simple/sipmsg.c Sat Jan 11 22:57:47 2014 -0800
@@ -35,6 +35,8 @@
#include "simple.h"
#include "sipmsg.h"
+#define MAX_CONTENT_LENGTH 30000000
+
struct sipmsg *sipmsg_parse_msg(const gchar *msg) {
const char *tmp = strstr(msg, "\r\n\r\n");
char *line;
@@ -118,6 +120,11 @@
purple_debug_warning("simple", "Invalid body length: %d",
msg->bodylen);
msg->bodylen = 0;
+ } else if (msg->bodylen > MAX_CONTENT_LENGTH) {
+ purple_debug_warning("simple", "Got Content-Length of %d bytes on "
+ "incoming message (max is %u bytes). Ignoring message body.\n",
+ msg->bodylen, MAX_CONTENT_LENGTH);
+ msg->bodylen = 0;
}
if(msg->response) {