58 lines
2.2 KiB
Plaintext
58 lines
2.2 KiB
Plaintext
$OpenBSD: patch-protocols_yahoo_yahoo_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
|
|
--- protocols/yahoo/yahoo.c.orig Thu Sep 9 22:06:54 2004
|
|
+++ protocols/yahoo/yahoo.c Thu Oct 14 15:43:35 2004
|
|
@@ -360,8 +360,11 @@ static int byahoo_chat_open( struct gaim
|
|
char *roomname;
|
|
YList *members;
|
|
|
|
- roomname = g_new0( char, strlen( gc->username ) + 16 );
|
|
- g_snprintf( roomname, strlen( gc->username ) + 16, "%s-Bee-%d", gc->username, byahoo_chat_id );
|
|
+ {
|
|
+ size_t len = strlen( gc->username ) + 16;
|
|
+ roomname = g_new0( char, len);
|
|
+ g_snprintf( roomname, len, "%s-Bee-%d", gc->username, byahoo_chat_id );
|
|
+ }
|
|
|
|
c = serv_got_joined_chat( gc, ++byahoo_chat_id, roomname );
|
|
add_chat_buddy( c, gc->username );
|
|
@@ -527,13 +530,17 @@ void ext_yahoo_login_response( int id, i
|
|
|
|
if( url && *url )
|
|
{
|
|
- s = g_malloc( strlen( "Error %d (%s). See %s for more information." ) + strlen( url ) + strlen( errstr ) + 16 );
|
|
- sprintf( s, "Error %d (%s). See %s for more information.", succ, errstr, url );
|
|
+ const char format[] = "Error %d (%s). See %s for more information.";
|
|
+ size_t s_len = strlen(format) + strlen( url ) + strlen( errstr ) + 16;
|
|
+ s = g_malloc( s_len);
|
|
+ snprintf( s, s_len, format, succ, errstr, url );
|
|
}
|
|
else
|
|
{
|
|
- s = g_malloc( strlen( "Error %d (%s)" ) + strlen( errstr ) + 16 );
|
|
- sprintf( s, "Error %d (%s)", succ, errstr );
|
|
+ const char format[] = "Error %d (%s)";
|
|
+ size_t s_len = strlen(format) + strlen( errstr ) + 16;
|
|
+ s = g_malloc(s_len);
|
|
+ snprintf( s, s_len, format, succ, errstr );
|
|
}
|
|
|
|
if( yd->logged_in )
|
|
@@ -736,7 +743,7 @@ int ext_yahoo_connect(char *host, int po
|
|
if(!(server = gethostbyname(host))) {
|
|
return -1;
|
|
}
|
|
- strncpy(last_host, host, 255);
|
|
+ strlcpy(last_host, host, sizeof(last_host));
|
|
}
|
|
|
|
if((servfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
|
@@ -799,7 +806,7 @@ void ext_yahoo_got_conf_invite( int id,
|
|
if( g_strcasecmp( m->data, gc->username ) != 0 )
|
|
add_chat_buddy( inv->c, m->data );
|
|
|
|
- g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", room, who, msg );
|
|
+ g_snprintf( txt, sizeof(txt), "Got an invitation to chatroom %s from %s: %s", room, who, msg );
|
|
|
|
do_ask_dialog( gc, txt, inv, byahoo_accept_conf, byahoo_reject_conf );
|
|
}
|