pidgin/pidgin

Merge release-2.x.y

2014-05-15, Tomasz Wasilczyk
9725f7b50000
Merge release-2.x.y
--- a/libpurple/protocols/mxit/filexfer.c Wed May 14 17:05:26 2014 +0200
+++ b/libpurple/protocols/mxit/filexfer.c Thu May 15 17:20:31 2014 +0200
@@ -167,13 +167,12 @@
filesize = purple_xfer_get_bytes_remaining( xfer );
buffer = g_malloc( filesize );
- if ( purple_xfer_read_file( xfer, buffer, filesize ) > 0 ) {
+ if (purple_xfer_read_file(xfer, buffer, filesize) == filesize) {
/* send data */
wrote = purple_xfer_write( xfer, buffer, filesize );
if ( wrote > 0 )
purple_xfer_set_bytes_sent( xfer, wrote );
- }
- else {
+ } else {
/* file read error */
purple_xfer_error( purple_xfer_get_xfer_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 Wed May 14 17:05:26 2014 +0200
+++ b/libpurple/protocols/sametime/sametime.c Thu May 15 17:20:31 2014 +0200
@@ -2215,7 +2215,7 @@
rem = mwFileTransfer_getRemaining(ft);
if(rem < MW_FT_LEN) o.len = rem;
- if(purple_xfer_read_file(xfer, buf, (size_t) o.len) > 0) {
+ if(purple_xfer_read_file(xfer, buf, (size_t) o.len) == o.len) {
/* calculate progress and display it */
purple_xfer_set_bytes_sent(xfer, purple_xfer_get_bytes_sent(xfer) + o.len);
--- a/libpurple/protocols/simple/simple.c Wed May 14 17:05:26 2014 +0200
+++ b/libpurple/protocols/simple/simple.c Thu May 15 17:20:31 2014 +0200
@@ -1724,6 +1724,8 @@
int newfd;
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/proxy.c Wed May 14 17:05:26 2014 +0200
+++ b/libpurple/proxy.c Thu May 15 17:20:31 2014 +0200
@@ -1723,6 +1723,11 @@
navas = *cmdbuf;
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"));
+ return -1;
+ }
cmdbuf++;
--- a/libpurple/prpl.h Wed May 14 17:05:26 2014 +0200
+++ b/libpurple/prpl.h Thu May 15 17:20:31 2014 +0200
@@ -1031,4 +1031,9 @@
G_END_DECLS
+#ifdef __COVERITY__
+#undef PURPLE_PROTOCOL_PLUGIN_HAS_FUNC
+#define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) (prpl->member != NULL)
+#endif
+
#endif /* _PRPL_H_ */
--- a/libpurple/util.c Wed May 14 17:05:26 2014 +0200
+++ b/libpurple/util.c Thu May 15 17:20:31 2014 +0200
@@ -3952,6 +3952,10 @@
for (i = 0; i < bytes; i++) {
if (j > (BUF_LEN - 4))
break;
+ if (i >= sizeof(utf_char)) {
+ g_warn_if_reached();
+ break;
+ }
sprintf(buf + j, "%%%02X", utf_char[i] & 0xff);
j += 3;
}
@@ -4607,6 +4611,10 @@
for (i = 0; i < bytes; i++) {
if (j > (BUF_LEN - 4))
break;
+ if (i >= sizeof(utf_char)) {
+ g_warn_if_reached();
+ break;
+ }
sprintf(buf + j, "%%%02x", utf_char[i] & 0xff);
j += 3;
}