openbsd-ports/net/bitlbee/patches/patch-protocols_msn_ns_c
martynas 117ac1f407 update to bitlbee-1.0.4
ok simon@ and maintainer Andrew Dalgleish;  tested by Wiktor Izdebski
2007-11-19 11:44:32 +00:00

80 lines
2.6 KiB
Plaintext

$OpenBSD: patch-protocols_msn_ns_c,v 1.3 2007/11/19 11:44:33 martynas Exp $
--- protocols/msn/ns.c.orig Mon Aug 20 16:27:14 2007
+++ protocols/msn/ns.c Mon Nov 19 13:39:01 2007
@@ -216,10 +216,9 @@ static int msn_ns_command( gpointer data, char **cmd,
}
else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 )
{
- http_decode( cmd[4] );
+ http_decode( cmd[4], strlen(cmd[4])+1 );
- strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
- gc->displayname[sizeof(gc->displayname)-1] = 0;
+ strlcpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
set_login_progress( gc, 1, "Authenticated, getting buddy list" );
@@ -291,7 +290,7 @@ static int msn_ns_command( gpointer data, char **cmd,
return( 0 );
}
- http_decode( cmd[2] );
+ http_decode( cmd[2], strlen(cmd[2])+1 );
list = atoi( cmd[3] );
if( list & 1 ) /* FL */
@@ -352,7 +351,7 @@ static int msn_ns_command( gpointer data, char **cmd,
g_snprintf( buf, sizeof( buf ), "QRY %d %s %d\r\n", ++md->trId, QRY_NAME, 32 );
for( i = 0; i < 16; i ++ )
- g_snprintf( buf + strlen( buf ), 3, "%02x", digest[i] );
+ g_snprintf( buf + strlen( buf ), sizeof(buf)-strlen(buf), "%02x", digest[i] );
return( msn_write( gc, buf, strlen( buf ) ) );
}
@@ -373,7 +372,7 @@ static int msn_ns_command( gpointer data, char **cmd,
return( 0 );
}
- http_decode( cmd[4] );
+ http_decode( cmd[4], strlen(cmd[4])+1 );
serv_buddy_rename( gc, cmd[3], cmd[4] );
st = msn_away_state_by_code( cmd[2] );
@@ -401,7 +400,7 @@ static int msn_ns_command( gpointer data, char **cmd,
return( 0 );
}
- http_decode( cmd[3] );
+ http_decode( cmd[3], strlen(cmd[3])+1 );
serv_buddy_rename( gc, cmd[2], cmd[3] );
st = msn_away_state_by_code( cmd[1] );
@@ -457,7 +456,7 @@ static int msn_ns_command( gpointer data, char **cmd,
{
GSList *l;
- http_decode( cmd[5] );
+ http_decode( cmd[5], strlen(cmd[5])+1 );
if( strchr( cmd[4], '@' ) == NULL )
{
@@ -511,14 +510,13 @@ static int msn_ns_command( gpointer data, char **cmd,
if( g_strcasecmp( cmd[3], gc->username ) == 0 )
{
- http_decode( cmd[4] );
- strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
- gc->displayname[sizeof(gc->displayname)-1] = 0;
+ http_decode( cmd[4], strlen(cmd[4])+1 );
+ strlcpy( gc->displayname, cmd[4], sizeof( gc->displayname ) );
}
else
{
/* This is not supposed to happen, but let's handle it anyway... */
- http_decode( cmd[4] );
+ http_decode( cmd[4], strlen(cmd[4])+1 );
serv_buddy_rename( gc, cmd[3], cmd[4] );
}
}