/pidgin/main: 9725f7b50000: Merge release-2.x.y

Tomasz Wasilczyk twasilczyk at pidgin.im
Thu May 15 11:22:12 EDT 2014


Changeset: 9725f7b50000a0e6d42abdabceb94f59c2b9ac5e
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-05-15 17:20 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/9725f7b50000

Description:

Merge release-2.x.y

diffstat:

 libpurple/protocols/mxit/filexfer.c     |  5 ++---
 libpurple/protocols/sametime/sametime.c |  2 +-
 libpurple/protocols/simple/simple.c     |  2 ++
 libpurple/proxy.c                       |  5 +++++
 libpurple/prpl.h                        |  5 +++++
 libpurple/util.c                        |  8 ++++++++
 6 files changed, 23 insertions(+), 4 deletions(-)

diffs (96 lines):

diff --git a/libpurple/protocols/mxit/filexfer.c b/libpurple/protocols/mxit/filexfer.c
--- a/libpurple/protocols/mxit/filexfer.c
+++ b/libpurple/protocols/mxit/filexfer.c
@@ -167,13 +167,12 @@ static void mxit_xfer_start( PurpleXfer*
 		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 );
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -2215,7 +2215,7 @@ static void ft_send(struct mwFileTransfe
   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);
diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c
--- a/libpurple/protocols/simple/simple.c
+++ b/libpurple/protocols/simple/simple.c
@@ -1724,6 +1724,8 @@ static void simple_newconn_cb(gpointer d
 	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);
diff --git a/libpurple/proxy.c b/libpurple/proxy.c
--- a/libpurple/proxy.c
+++ b/libpurple/proxy.c
@@ -1723,6 +1723,11 @@ s5_parse_chap_msg(PurpleProxyConnectData
 	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++;
 
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -1031,4 +1031,9 @@ PurplePlugin *purple_find_prpl(const cha
 
 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_ */
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -3952,6 +3952,10 @@ purple_url_encode(const char *str)
 			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 @@ purple_escape_filename(const char *str)
 			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;
 			}



More information about the Commits mailing list