libpurple/protocols/mxit/protocol.c

branch
release-2.x.y
changeset 37818
f0287378203f
parent 37663
2953de8b793c
child 37849
8943e2d16d5a
--- a/libpurple/protocols/mxit/protocol.c	Sun May 15 05:41:39 2016 -0300
+++ b/libpurple/protocols/mxit/protocol.c	Fri Jun 03 11:50:10 2016 -0500
@@ -1819,6 +1819,12 @@
 	/* set the count for attributes */
 	count = atoi( records[0]->fields[1]->data );
 
+	/* ensure the packet has the correct number of fields */
+	if ( records[0]->fcount < ( 2 + ( count * 3 ) ) ) {
+		purple_debug_error( MXIT_PLUGIN_ID, "Insufficient number of fields in extprofile response. fields=%i records=%i", records[0]->fcount, count );
+		return;
+	}
+
 	for ( i = 0; i < count; i++ ) {
 		char* fname;
 		char* fvalue;

mercurial