$OpenBSD: patch-protocols_nogaim_c,v 1.4 2007/01/14 21:53:01 simon Exp $ --- protocols/nogaim.c.orig Sat Jun 24 17:00:44 2006 +++ protocols/nogaim.c Fri Dec 15 21:20:07 2006 @@ -423,8 +423,8 @@ void add_buddy( struct gaim_connection * /* Buddy seems to exist already. Let's ignore this request then... */ } - memset( nick, 0, MAX_NICK_LENGTH + 1 ); - strcpy( nick, nick_get( gc->irc, handle, gc->protocol, realname ) ); + memset( nick, 0, sizeof(nick)); + strlcpy( nick, nick_get( gc->irc, handle, gc->protocol, realname ), sizeof(nick) ); u = user_add( gc->irc, nick ); @@ -476,8 +476,8 @@ struct buddy *find_buddy( struct gaim_co return( NULL ); memset( b, 0, sizeof( b ) ); - strncpy( b->name, handle, 80 ); - strncpy( b->show, u->realname, BUDDY_ALIAS_MAXLEN ); + strlcpy( b->name, handle, sizeof(b->name)); + strlcpy( b->show, u->realname, sizeof(b->show)); b->present = u->online; b->gc = u->gc; @@ -817,8 +817,11 @@ struct conversation *serv_got_joined_cha c->gc = gc; c->title = g_strdup( handle ); - s = g_new( char, 16 ); - sprintf( s, "&chat_%03d", gc->irc->c_id++ ); + { + size_t s_len = 16; + s = g_new( char, s_len); + g_snprintf( s, s_len, "&chat_%03d", gc->irc->c_id++ ); + } c->channel = g_strdup( s ); g_free( s ); @@ -994,7 +997,7 @@ char *set_eval_away_devoice( irc_t *irc, count = 0; } - sprintf( list + strlen( list ), " %s", u->nick ); + g_snprintf( list + strlen( list ), sizeof(list)-strlen(list), " %s", u->nick ); count ++; } u = u->next;