diff options
author | Mike Kazantsev <mk.fraggod@gmail.com> | 2013-02-14 16:20:00 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-02-14 16:20:00 +0100 |
commit | 61d2eabb1651e771937ea34794a501115d8cd49f (patch) | |
tree | c47d3d65dbd05eeea45686a664785654af8c0d1c | |
parent | b6ab05bd13a498204ae322c9d9fd1eb5ec6abb30 (diff) |
skype: check for truncated commands on receiving
-rw-r--r-- | protocols/skype/skype.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index d879e3ed..963406db 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -28,7 +28,7 @@ #define SKYPE_DEFAULT_SERVER "localhost" #define SKYPE_DEFAULT_PORT "2727" -#define IRC_LINE_SIZE 1024 +#define IRC_LINE_SIZE 16384 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) /* @@ -1146,6 +1146,13 @@ static gboolean skype_read_callback(gpointer data, gint fd, return FALSE; /* Read the whole data. */ st = ssl_read(sd->ssl, buf, sizeof(buf)); + if (st >= IRC_LINE_SIZE-1) { + /* As we don't buffer incoming data, if IRC_LINE_SIZE amount of bytes + * were received, there's a good chance last message was truncated + * and the next recv() will yield garbage. */ + imcb_error(ic, "Unable to handle incoming data from skyped"); + st = 0; + } if (st > 0) { buf[st] = '\0'; /* Then split it up to lines. */ |