--- a/libpurple/protocols/mxit/protocol.c Wed Apr 03 00:53:35 2013 +0200
+++ b/libpurple/protocols/mxit/protocol.c Wed Apr 03 01:25:40 2013 +0200
@@ -100,26 +100,27 @@
void dump_bytes( struct MXitSession* session, const char* buf, int len )
- char msg[( len * 3 ) + 1];
- memset( msg, 0x00, sizeof( msg ) );
+ char* msg = g_malloc0( len + 1 ); for ( i = 0; i < len; i++ ) {
- if ( buf[i] == CP_REC_TERM ) /* record terminator */
+ if ( ch == CP_REC_TERM ) /* record terminator */ - else if ( buf[i] == CP_FLD_TERM ) /* field terminator */
+ else if ( ch == CP_FLD_TERM ) /* field terminator */ - else if ( buf[i] == CP_PKT_TERM ) /* packet terminator */
+ else if ( ch == CP_PKT_TERM ) /* packet terminator */ - else if ( buf[i] < 0x20 )
+ else if ( ( ch < 0x20 ) || ( ch > 0x7E ) ) /* non-printable character */
purple_debug_info( MXIT_PLUGIN_ID, "DUMP: '%s'\n", msg );