--- a/libpurple/protocols/mxit/filexfer.c Mon May 12 23:55:54 2014 +0200
+++ b/libpurple/protocols/mxit/filexfer.c Thu May 15 15:01:47 2014 +0200
@@ -167,13 +167,12 @@
filesize = purple_xfer_get_bytes_remaining( xfer );
buffer = g_malloc( filesize );
- if ( fread( buffer, filesize, 1, xfer->dest_fp ) > 0 ) {
+ if (fread(buffer, filesize, 1, xfer->dest_fp) == 1) { wrote = purple_xfer_write( xfer, buffer, filesize );
purple_xfer_set_bytes_sent( xfer, wrote );
purple_xfer_error( purple_xfer_get_type( xfer ), purple_xfer_get_account( xfer ), purple_xfer_get_remote_user( xfer ), _( "Unable to access the local file" ) );
purple_xfer_cancel_local( xfer );
--- a/libpurple/protocols/sametime/sametime.c Mon May 12 23:55:54 2014 +0200
+++ b/libpurple/protocols/sametime/sametime.c Thu May 15 15:01:47 2014 +0200
@@ -2213,7 +2213,7 @@
rem = mwFileTransfer_getRemaining(ft);
if(rem < MW_FT_LEN) o.len = rem;
- if(fread(buf, (size_t) o.len, 1, fp)) {
+ if (fread(buf, (size_t)o.len, 1, fp) == 1) { /* calculate progress and display it */
xfer->bytes_sent += o.len;
--- a/libpurple/protocols/simple/simple.c Mon May 12 23:55:54 2014 +0200
+++ b/libpurple/protocols/simple/simple.c Thu May 15 15:01:47 2014 +0200
@@ -1724,6 +1724,8 @@
newfd = accept(source, NULL, NULL);
+ g_return_if_fail(newfd > 0); _purple_network_set_common_socket_flags(newfd);
conn = connection_create(sip, newfd);
--- a/libpurple/protocols/zephyr/Zinternal.c Mon May 12 23:55:54 2014 +0200
+++ b/libpurple/protocols/zephyr/Zinternal.c Thu May 15 15:01:47 2014 +0200
@@ -526,13 +526,13 @@
- if (!(lasthole->next = (struct _Z_Hole *)
+ if (!(lasthole->next = (struct _Z_Hole *)(struct _Z_InputQ *) malloc(sizeof(struct _Z_InputQ))))
- if (!(qptr->holelist = (struct _Z_Hole *)
+ if (!(qptr->holelist = (struct _Z_Hole *)(struct _Z_InputQ *) malloc(sizeof(struct _Z_InputQ))))
@@ -550,13 +550,13 @@
- if (!(lasthole->next = (struct _Z_Hole *)
+ if (!(lasthole->next = (struct _Z_Hole *)(struct _Z_InputQ *) malloc(sizeof(struct _Z_InputQ))))
- if (!(qptr->holelist = (struct _Z_Hole *)
+ if (!(qptr->holelist = (struct _Z_Hole *)(struct _Z_InputQ *) malloc(sizeof(struct _Z_InputQ))))
--- a/libpurple/proxy.c Mon May 12 23:55:54 2014 +0200
+++ b/libpurple/proxy.c Thu May 15 15:01:47 2014 +0200
@@ -1720,6 +1720,11 @@
purple_debug_misc("socks5 proxy", "Expecting %d attribute(s).\n", navas);
+ if (G_UNLIKELY(navas > 10000)) { /* XXX: what's the threshold? */ + purple_proxy_connect_data_disconnect(connect_data, + _("Received invalid data on connection with server")); --- a/libpurple/util.c Mon May 12 23:55:54 2014 +0200
+++ b/libpurple/util.c Thu May 15 15:01:47 2014 +0200
@@ -4352,6 +4352,10 @@
for (i = 0; i < bytes; i++) {
+ if (i >= sizeof(utf_char)) { sprintf(buf + j, "%%%02X", utf_char[i] & 0xff);
@@ -5007,6 +5011,10 @@
for (i = 0; i < bytes; i++) {
+ if (i >= sizeof(utf_char)) { sprintf(buf + j, "%%%02x", utf_char[i] & 0xff);