libpurple/protocols/mxit/protocol.c

branch
release-2.x.y
changeset 37849
8943e2d16d5a
parent 37848
34d56e0586c4
parent 37818
f0287378203f
child 37850
43aa3fab2883
--- a/libpurple/protocols/mxit/protocol.c	Sun Jun 12 22:26:39 2016 -0500
+++ b/libpurple/protocols/mxit/protocol.c	Sun Jun 12 22:28:11 2016 -0500
@@ -1840,6 +1840,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