$OpenBSD: patch-nick_c,v 1.3 2006/04/11 15:11:33 naddy Exp $ --- nick.c.orig Fri Dec 9 22:59:55 2005 +++ nick.c Sun Jan 29 03:28:20 2006 @@ -65,7 +65,7 @@ char *nick_get( irc_t *irc, const char * while( n && !*nick ) if( ( n->proto == proto ) && ( g_strcasecmp( n->handle, handle ) == 0 ) ) - strcpy( nick, n->nick ); + strlcpy( nick, n->nick, sizeof(nick) ); else n = n->next; @@ -73,7 +73,7 @@ char *nick_get( irc_t *irc, const char * { char *s; - g_snprintf( nick, MAX_NICK_LENGTH, "%s", handle ); + g_snprintf( nick, sizeof(nick), "%s", handle ); if( ( s = strchr( nick, '@' ) ) ) while( *s ) *(s++) = 0; @@ -82,7 +82,7 @@ char *nick_get( irc_t *irc, const char * use the realname instead. */ for( s = nick; *s && isdigit( *s ); s ++ ); if( !*s && realname && *realname ) - g_snprintf( nick, MAX_NICK_LENGTH, "%s", realname ); + g_snprintf( nick, sizeof(nick), "%s", realname ); nick_strip( nick ); if (set_getint(irc, "lcnicks")) @@ -119,7 +119,7 @@ char *nick_get( irc_t *irc, const char * "Good luck, and please don't forget to paste the lines up here " "in #bitlbee on OFTC or in a mail to wilmer@gaast.net" ); - g_snprintf( nick, MAX_NICK_LENGTH + 1, "xx%x", rand() ); + g_snprintf( nick, sizeof(nick), "xx%x", rand() ); break; } @@ -240,8 +240,8 @@ int nick_cmp( const char *a, const char { char aa[1024] = "", bb[1024] = ""; - strncpy( aa, a, sizeof( aa ) - 1 ); - strncpy( bb, b, sizeof( bb ) - 1 ); + strlcpy( aa, a, sizeof( aa ) ); + strlcpy( bb, b, sizeof( bb ) ); if( nick_lc( aa ) && nick_lc( bb ) ) { return( strcmp( aa, bb ) );