[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UPDATE: net/bitlbee



Updated to 1.0.1
Tested on i386-current
(I haven't tried connecting to google talk yet)

Regards,
Andrew Dalgleish
Index: Makefile
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/Makefile,v
retrieving revision 1.17
diff -u -w -r1.17 Makefile
--- Makefile	16 Mar 2005 01:56:49 -0000	1.17
+++ Makefile	29 Jan 2006 12:47:12 -0000
@@ -2,8 +2,7 @@
 
 COMMENT=	"IRC proxy to connect to AIM, ICQ, Jabber, MSN and Yahoo"
 
-DISTNAME=		bitlbee-0.91
-PKGNAME=		${DISTNAME}p2
+DISTNAME=		bitlbee-1.0.1
 CATEGORIES=		net
 
 HOMEPAGE=		http://bitlbee.org
@@ -22,13 +21,12 @@
 DB_DIR?=		/var/bitlbee
 ETCDIR=			${SYSCONFDIR}/bitlbee
 EXAMPLEDIR=		${PREFIX}/share/examples/bitlbee
-DOCS=			${WRKSRC}/doc/user-guide.html
+DOCS=			${WRKSRC}/doc/user-guide/user-guide.html
 DOCDIR=			${PREFIX}/share/doc/bitlbee/
 
 BUILD_DEPENDS=		:pkgconfig-*:devel/pkgconfig
 LIB_DEPENDS=		glib-2.0.0.0::devel/glib2
 
-# I am told gnutls does not build on all arches, so I've added a no_ssl FLAVOR
 # SSL is required for MSN support, and is optional for Jabber
 FLAVORS=		no_ssl
 FLAVOR?=
@@ -37,27 +35,23 @@
 CONFIGURE_ARGS+=	--msn=0 \
 			--ssl=bogus
 .else
-LIB_DEPENDS+=		gnutls.8::security/gnutls
-WANTLIB+=		gcrypt gpg-error
+CONFIGURE_ARGS+=	--ssl=openssl
+WANTLIB+=		crypto ssl
 .endif
 
 CONFIGURE_STYLE=	simple
 CONFIGURE_ARGS+=	--bindir=${PREFIX}/libexec \
 			--mandir=${PREFIX}/man \
 			--config=${DB_DIR} \
-			--etcdir=${ETCDIR} \
-			--flood=1
+			--etcdir=${ETCDIR}
 
 USE_GMAKE=		Yes
-MAKE_ENV=		CC="${CC}"
+MAKE_ENV=		"CC=${CC}" "CFLAGS=${CFLAGS}"
 FAKE_FLAGS=		${DESTDIRNAME}=${WRKINST} ETCDIR=${EXAMPLEDIR}
 FAKE_TARGET=		install install-etc
+SUBST_VARS=		DB_DIR
 
 NO_REGRESS=		Yes
-
-# Make sure we use the system snprintf
-post-extract:
-	@rm -f ${WRKSRC}/protocols/snprintf.c
 
 post-install:
 	${INSTALL_DATA_DIR} ${DOCDIR}
Index: distinfo
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/distinfo,v
retrieving revision 1.10
diff -u -w -r1.10 distinfo
--- distinfo	5 Jan 2005 17:14:39 -0000	1.10
+++ distinfo	23 Jan 2006 17:41:49 -0000
@@ -1,4 +1,4 @@
-MD5 (bitlbee-0.91.tar.gz) = a2fa42959708fd06eb281f03a7d7d3fe
-RMD160 (bitlbee-0.91.tar.gz) = e86c0d404c942d90813bd959e92c5ce7158f5e3d
-SHA1 (bitlbee-0.91.tar.gz) = f2f202ff86380e193044625ee3a258943d3b3aed
-SIZE (bitlbee-0.91.tar.gz) = 462675
+MD5 (bitlbee-1.0.1.tar.gz) = a4d7daa9b64898dd41a3a6d104692d9a
+RMD160 (bitlbee-1.0.1.tar.gz) = 0db0f77dce1de4a3f4a597793a374db8f99c0c96
+SHA1 (bitlbee-1.0.1.tar.gz) = 7f1554f3bcec943c0b18c93f147e0b25fd5fe31e
+SIZE (bitlbee-1.0.1.tar.gz) = 458676
Index: patches/patch-account_c
===================================================================
RCS file: patches/patch-account_c
diff -N patches/patch-account_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-account_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+--- account.c.orig	Sat Sep 17 22:42:26 2005
++++ account.c	Tue Nov  1 21:50:11 2005
+@@ -134,9 +134,9 @@ void account_on( irc_t *irc, account_t *
+ 	u = g_new0 ( struct aim_user, 1 );
+ 	u->irc = irc;
+ 	u->protocol = a->protocol;
+-	strncpy( u->username, a->user, sizeof( u->username ) - 1 );
+-	strncpy( u->password, a->pass, sizeof( u->password ) - 1 );
+-	if( a->server) strncpy( u->proto_opt[0], a->server, sizeof( u->proto_opt[0] ) - 1 );
++	strlcpy( u->username, a->user, sizeof( u->username ) );
++	strlcpy( u->password, a->pass, sizeof( u->password ) );
++	if( a->server) strlcpy( u->proto_opt[0], a->server, sizeof( u->proto_opt[0] ) );
+ 	
+ 	a->gc = (struct gaim_connection *) u; /* Bit hackish :-/ */
+ 	a->reconnect = 0;
Index: patches/patch-bitlbee_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-bitlbee_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-bitlbee_c
--- patches/patch-bitlbee_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-bitlbee_c	29 Jan 2006 02:08:53 -0000
@@ -1,7 +1,28 @@
 $OpenBSD: patch-bitlbee_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- bitlbee.c.orig	Wed Jul 21 09:36:07 2004
-+++ bitlbee.c	Fri Oct 15 14:43:15 2004
-@@ -306,7 +306,7 @@ int bitlbee_load( irc_t *irc, char* pass
+--- bitlbee.c.orig	Sun Jan 15 02:13:11 2006
++++ bitlbee.c	Sun Jan 29 13:08:40 2006
+@@ -35,7 +35,7 @@
+ 
+ gboolean bitlbee_io_new_client( GIOChannel *source, GIOCondition condition, gpointer data )
+ {
+-	size_t size = sizeof( struct sockaddr_in );
++	socklen_t size = sizeof( struct sockaddr_in );
+ 	struct sockaddr_in conn_info;
+ 	int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, 
+ 		                     &size );
+@@ -154,8 +154,9 @@ gboolean bitlbee_io_current_client_read(
+ 	}
+ 	else 
+ 	{
+-		irc->readbuffer = g_renew( char, irc->readbuffer, strlen( irc->readbuffer ) + strlen ( line ) + 1 );
+-		strcpy( ( irc->readbuffer + strlen( irc->readbuffer ) ), line );
++		size_t newlen = strlen(irc->readbuffer) + strlen(line) + 1;
++		irc->readbuffer = g_renew( char, irc->readbuffer, newlen);
++		strlcat(irc->readbuffer, line, newlen);
+ 	}
+ 	
+ 	if( !irc_process( irc ) )
+@@ -231,10 +232,11 @@ int bitlbee_load( irc_t *irc, const char
  	if( irc->status == USTATUS_IDENTIFIED )
  		return( 1 );
  	
@@ -10,7 +31,11 @@
     	fp = fopen( s, "r" );
     	if( !fp ) return( 0 );
  	
-@@ -318,6 +318,7 @@ int bitlbee_load( irc_t *irc, char* pass
++	COMPILE_TIME_ASSERT(32 < sizeof(s));
+ 	fscanf( fp, "%32[^\n]s", s );
+ 	if( setpass( irc, password, s ) < 0 )
+ 	{
+@@ -246,6 +248,7 @@ int bitlbee_load( irc_t *irc, const char
  	   account command will not work otherwise. */
  	irc->status = USTATUS_IDENTIFIED;
  	
@@ -18,7 +43,7 @@
  	while( fscanf( fp, "%511[^\n]s", s ) > 0 )
  	{
  		fgetc( fp );
-@@ -327,7 +328,7 @@ int bitlbee_load( irc_t *irc, char* pass
+@@ -255,19 +258,21 @@ int bitlbee_load( irc_t *irc, const char
  	}
  	fclose( fp );
  	
@@ -26,17 +51,25 @@
 +	g_snprintf( s, sizeof(s), "%s%s%s", global.conf->configdir, irc->nick, ".nicks" );
  	fp = fopen( s, "r" );
  	if( !fp ) return( 0 );
- 	while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 )
-@@ -339,7 +340,7 @@ int bitlbee_load( irc_t *irc, char* pass
+-	while( fscanf( fp, "%s %d %s", s, &proto, nick ) > 0 )
++	COMPILE_TIME_ASSERT(511 < sizeof(s));
++	COMPILE_TIME_ASSERT(24 < sizeof(nick));
++	while( fscanf( fp, "%511s %d %24s", s, &proto, nick ) > 0 )
+ 	{
+-		http_decode( s );
++		http_decode( s, sizeof(s) );
+ 		nick_set( irc, s, proto, nick );
+ 	}
+ 	fclose( fp );
  	
  	if( set_getint( irc, "auto_connect" ) )
  	{
 -		strcpy( s, "account on" );	/* Can't do this directly because r_c_s alters the string */
 +		strlcpy( s, "account on", sizeof(s) );	/* Can't do this directly because r_c_s alters the string */
- 		root_command_string( irc, ru, s );
+ 		root_command_string( irc, ru, s, 0 );
  	}
  	
-@@ -380,15 +381,15 @@ int bitlbee_save( irc_t *irc )
+@@ -308,15 +313,15 @@ int bitlbee_save( irc_t *irc )
  		return( 0 );
  	}
  	
@@ -57,16 +90,16 @@
  		if( fprintf( fp, "%s\n", s ) != strlen( s ) + 1 )
  		{
  			irc_usermsg( irc, "fprintf() wrote too little. Disk full?" );
-@@ -398,7 +399,7 @@ int bitlbee_save( irc_t *irc )
+@@ -330,7 +335,7 @@ int bitlbee_save( irc_t *irc )
+ 		return( 0 );
  	}
- 	fclose( fp );
    
 -	g_snprintf( new_path, 512, "%s%s%s", global.conf->configdir, irc->nick, ".nicks" );
 +	g_snprintf( new_path, sizeof(new_path), "%s%s%s", global.conf->configdir, irc->nick, ".nicks" );
  	if( unlink( new_path ) != 0 )
  	{
  		if( errno != ENOENT )
-@@ -413,7 +414,7 @@ int bitlbee_save( irc_t *irc )
+@@ -345,7 +350,7 @@ int bitlbee_save( irc_t *irc )
  		return( 0 );
  	}
  	
@@ -75,52 +108,12 @@
  	fp = fopen( path, "w" );
  	if( !fp ) return( 0 );
  	if( fprintf( fp, "%s", hash ) != strlen( hash ) )
-@@ -481,7 +482,7 @@ int bitlbee_save( irc_t *irc )
+@@ -417,7 +422,7 @@ int bitlbee_save( irc_t *irc )
+ 		return( 0 );
  	}
- 	fclose( fp );
  	
 - 	g_snprintf( new_path, 512, "%s%s%s", global.conf->configdir, irc->nick, ".accounts" );
 + 	g_snprintf( new_path, sizeof(new_path), "%s%s%s", global.conf->configdir, irc->nick, ".accounts" );
   	if( unlink( new_path ) != 0 )
  	{
  		if( errno != ENOENT )
-@@ -565,8 +566,9 @@ void http_decode( char *s )
- {
- 	char *t;
- 	int i, j, k;
-+	size_t s_len = strlen(s) + 1;
- 	
--	t = bitlbee_alloc( strlen( s ) + 1 );
-+	t = bitlbee_alloc(s_len);
- 	
- 	for( i = j = 0; s[i]; i ++, j ++ )
- 	{
-@@ -590,24 +592,24 @@ void http_decode( char *s )
- 	}
- 	t[j] = 0;
- 	
--	strcpy( s, t );
-+	strlcpy( s, t, s_len );
- 	g_free( t );
- }
- 
- /* Warning: This one explodes the string. Worst-cases can make the string 3x its original size! */
- /* This fuction is safe, but make sure you call it safely as well! */
--void http_encode( char *s )
-+void http_encode( char *s, size_t s_len )
- {
- 	char *t;
- 	int i, j;
- 	
- 	t = g_strdup( s );
- 	
--	for( i = j = 0; t[i]; i ++, j ++ )
-+	for( i = j = 0; t[i] && j < s_len -1; i ++, j ++ )
- 	{
- 		if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' )
- 		{
--			sprintf( s + j, "%%%02X", t[i] );
-+			g_snprintf( s + j, s_len - j, "%%%02X", t[i] );
- 			j += 2;
- 		}
- 		else
Index: patches/patch-bitlbee_h
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-bitlbee_h,v
retrieving revision 1.5
diff -u -w -r1.5 patch-bitlbee_h
--- patches/patch-bitlbee_h	21 Oct 2004 14:48:51 -0000	1.5
+++ patches/patch-bitlbee_h	28 Jan 2006 16:39:41 -0000
@@ -1,29 +1,35 @@
 $OpenBSD: patch-bitlbee_h,v 1.5 2004/10/21 14:48:51 naddy Exp $
 Use a more usefull name for the server
---- bitlbee.h.orig	Sat Sep 25 21:15:15 2004
-+++ bitlbee.h	Thu Oct 14 15:43:33 2004
-@@ -75,7 +75,7 @@
+--- bitlbee.h.orig	Sun Jan 15 02:16:07 2006
++++ bitlbee.h	Sun Jan 29 03:24:55 2006
+@@ -69,7 +69,6 @@
+ #undef strndup
+ #define strndup		__PLEASE_USE_THE_GLIB_STRDUP_FUNCTIONS_SYSTEM_INSTEAD__
+ #undef snprintf
+-#define snprintf	__PLEASE_USE_G_SNPRINTF_INSTEAD__
+ #undef strcasecmp
+ #define strcasecmp	__PLEASE_USE_G_STRCASECMP_INSTEAD__
+ #undef strncasecmp
+@@ -81,7 +80,7 @@
  
  #define _( x ) x
  
 -#define ROOT_NICK "root"
 +#define ROOT_NICK "bitlbee"
- #define ROOT_CHAN "#bitlbee"
+ #define ROOT_CHAN "&bitlbee"
  #define ROOT_FN "User manager"
  
-@@ -127,7 +127,7 @@ int root_command( irc_t *irc, char *comm
- int bitlbee_load( irc_t *irc, char *password );
+@@ -130,10 +129,18 @@ int bitlbee_load( irc_t *irc, const char
  int bitlbee_save( irc_t *irc );
+ void bitlbee_shutdown( gpointer data );
  double gettime( void );
 -G_MODULE_EXPORT void http_encode( char *s );
+-G_MODULE_EXPORT void http_decode( char *s );
 +G_MODULE_EXPORT void http_encode( char *s, size_t s_len );
- G_MODULE_EXPORT void http_decode( char *s );
- 
- void *bitlbee_alloc(size_t size);
-@@ -135,5 +135,12 @@ void *bitlbee_realloc(void *oldmem, size
++G_MODULE_EXPORT void http_decode( char *s, size_t s_len );
+ G_MODULE_EXPORT char *strip_newlines(char *source);
  
  extern global_t global;
- extern GList *connection_list;
 +
 +#define COMPILE_TIME_ASSERT(ex) do {\
 +typedef char COMPILE_TIME_ASSERTION_FAILURE[(ex) ? 1 : -1];\
@@ -31,5 +37,6 @@
 +
 +#define FILE_SCOPED_COMPILE_TIME_ASSERT(ex) \
 +extern char COMPILE_TIME_ASSERTION_FAILURE[(ex) ? 1 : -1];
++ 
  
  #endif
Index: patches/patch-commands_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-commands_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-commands_c
--- patches/patch-commands_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-commands_c	28 Jan 2006 16:39:41 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-commands_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- commands.c.orig	Tue Sep 21 07:07:16 2004
-+++ commands.c	Fri Oct 15 14:30:16 2004
+--- commands.c.orig	Fri Nov 18 11:17:04 2005
++++ commands.c	Sun Jan 29 03:23:00 2006
 @@ -63,8 +63,8 @@ int cmd_help( irc_t *irc, char **cmd )
  	memset( param, 0, sizeof(param) );
  	for ( i = 1; (cmd[i] != NULL && ( strlen(param) < (sizeof(param)-1) ) ); i++ ) {
Index: patches/patch-conf_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-conf_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-conf_c
--- patches/patch-conf_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-conf_c	23 Jan 2006 17:39:46 -0000
@@ -1,16 +1,29 @@
 $OpenBSD: patch-conf_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- conf.c.orig	Fri Sep 24 05:42:32 2004
-+++ conf.c	Thu Oct 14 15:43:33 2004
-@@ -130,9 +130,10 @@ conf_t *conf_load( int argc, char *argv[
+--- conf.c.orig	Thu Feb 24 02:47:58 2005
++++ conf.c	Tue Nov  1 21:50:32 2005
+@@ -129,9 +129,10 @@ conf_t *conf_load( int argc, char *argv[
  	
  	if( conf->configdir[strlen(conf->configdir)-1] != '/' )
  	{
--		char *s = bitlbee_alloc( strlen( conf->configdir ) + 2 );
+-		char *s = g_new( char, strlen( conf->configdir ) + 2 );
 +		size_t s_len = strlen( conf->configdir ) + 2 ;
-+		char *s = bitlbee_alloc( s_len );
++		char *s = g_new( char, s_len);
  		
 -		sprintf( s, "%s/", conf->configdir );
 +		g_snprintf( s, s_len, "%s/", conf->configdir );
  		g_free( conf->configdir );
  		conf->configdir = s;
  	}
+@@ -226,9 +227,9 @@ static int conf_loadini( conf_t *conf, c
+ 					return( 0 );
+ 				}
+ 				
+-				strncpy( proxyhost, url->host, sizeof( proxyhost ) );
+-				strncpy( proxyuser, url->user, sizeof( proxyuser ) );
+-				strncpy( proxypass, url->pass, sizeof( proxypass ) );
++				strlcpy( proxyhost, url->host, sizeof( proxyhost ) );
++				strlcpy( proxyuser, url->user, sizeof( proxyuser ) );
++				strlcpy( proxypass, url->pass, sizeof( proxypass ) );
+ 				proxyport = url->port;
+ 				if( url->proto == PROTO_HTTP )
+ 					proxytype = PROXY_HTTP;
Index: patches/patch-configure
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-configure,v
retrieving revision 1.4
diff -u -w -r1.4 patch-configure
--- patches/patch-configure	20 Jun 2004 16:27:49 -0000	1.4
+++ patches/patch-configure	28 Jan 2006 16:39:42 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-configure,v 1.4 2004/06/20 16:27:49 naddy Exp $
---- configure.orig	2004-05-19 07:02:29.000000000 +1000
-+++ configure	2004-06-08 20:01:18.000000000 +1000
+--- configure.orig	Sun Jan 15 02:14:05 2006
++++ configure	Sun Jan 29 03:23:47 2006
 @@ -82,6 +82,8 @@ CONFIG=$config
  
  ARCH=$arch
@@ -10,12 +10,12 @@
  OUTFILE=bitlbee
  
  DESTDIR=
-@@ -107,8 +109,6 @@ if [ "$debug" = "1" ]; then
+@@ -110,8 +112,6 @@ if [ "$debug" = "1" ]; then
  	echo 'CFLAGS=-g' >> Makefile.settings
  	echo 'DEBUG=1' >> Makefile.settings
  	echo '#define DEBUG' >> config.h
 -else
--	echo 'CFLAGS=-O3' >> Makefile.settings;
+-	echo 'CFLAGS=-O3' >> Makefile.settings
  fi
  
  echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings
Index: patches/patch-crypting_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-crypting_c,v
retrieving revision 1.1
diff -u -w -r1.1 patch-crypting_c
--- patches/patch-crypting_c	20 Jun 2004 16:27:49 -0000	1.1
+++ patches/patch-crypting_c	28 Jan 2006 16:39:42 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-crypting_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
---- crypting.c.orig	2004-05-05 00:25:36.000000000 +1000
-+++ crypting.c	2004-06-08 20:08:19.000000000 +1000
-@@ -111,11 +111,15 @@ char *hashpass (irc_t *irc) {
+--- crypting.c.orig	Sun Jan 15 02:04:28 2006
++++ crypting.c	Sun Jan 29 03:27:22 2006
+@@ -117,11 +117,15 @@ char *hashpass (irc_t *irc) {
  	int i;
  	char digits[3];
  	char *rv;
@@ -18,8 +18,8 @@
 +	memset (rv, 0, rv_len);
  	
  	md5_init (&md5state);
- 	md5_append (&md5state, irc->password, strlen (irc->password));
-@@ -124,7 +128,7 @@ char *hashpass (irc_t *irc) {
+ 	md5_append (&md5state, (unsigned char *)irc->password, strlen (irc->password));
+@@ -130,7 +134,7 @@ char *hashpass (irc_t *irc) {
  	for (i = 0; i < 16; i++) {
  		/* Build a hash of the pass */
  		g_snprintf (digits, sizeof (digits), "%02x", digest[i]);
@@ -28,43 +28,7 @@
  	}
  	
  	return (rv);
-@@ -133,11 +137,15 @@ char *hashpass (irc_t *irc) {
- char *obfucrypt (irc_t *irc, char *line) {
- 	int i, j;
- 	char *rv;
-+	size_t rv_len;
- 	
- 	if (irc->password == NULL) return (NULL);
- 	
--	rv = (char *)g_malloc (strlen (line) + 1);
--	memset (rv, '\0', strlen (line) + 1);
-+	rv_len = strlen (line) + 1;
-+	rv = (char *)g_malloc (rv_len);
-+	if (!rv) return NULL;
-+
-+	memset (rv, 0, rv_len);
- 	
- 	i = j = 0;
- 	while (*line) {
-@@ -158,11 +166,15 @@ char *obfucrypt (irc_t *irc, char *line)
- char *deobfucrypt (irc_t *irc, char *line) {
- 	int i, j;
- 	char *rv;
-+	size_t rv_len;
- 	
- 	if (irc->password == NULL) return (NULL);
- 	
--	rv = (char *)g_malloc (strlen (line) + 1);
--	memset (rv, '\0', strlen (line) + 1);
-+	rv_len = strlen (line) + 1;
-+	rv = (char *)g_malloc (rv_len);
-+	if (!rv) return NULL;
-+
-+	memset (rv, 0, rv_len);
- 	
- 	i = j = 0;
- 	while (*line) {
-@@ -224,6 +236,7 @@ int main( int argc, char *argv[] )
+@@ -229,6 +233,7 @@ int main( int argc, char *argv[] )
  		return( main( 0, NULL ) );
  	}
  	
Index: patches/patch-doc_user-guide_help_txt
===================================================================
RCS file: patches/patch-doc_user-guide_help_txt
diff -N patches/patch-doc_user-guide_help_txt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-doc_user-guide_help_txt	29 Jan 2006 02:04:40 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- doc/user-guide/help.txt.orig	Sun Dec  4 13:51:10 2005
++++ doc/user-guide/help.txt	Sun Jan 29 13:00:20 2006
+@@ -27,7 +27,7 @@ You can read more about them with help 
+ ?quickstart
+ Welcome to BitlBee, your IRC gateway to ICQ, MSN, AOL, Jabber and Yahoo Instant Messaging Systems.
+ 
+-The center of BitlBee is the control channel, &bitlbee. Two users will always be there, you (where "you" is the nickname you are using) and the system user, root.
++The center of BitlBee is the control channel, &bitlbee. Two users will always be there, you (where "you" is the nickname you are using) and the system user, root. Your installation may have redefined root, e.g. to bitlbee.
+ 
+ You need register so that all your IM settings (passwords, contacts, etc) can be saved on the BitlBee server. It's important that you pick a good password so no one else can access your account. Register with this password using the register command: register <password> (without the brackets!).
+ 
Index: patches/patch-doc_user-guide_user-guide_html
===================================================================
RCS file: patches/patch-doc_user-guide_user-guide_html
diff -N patches/patch-doc_user-guide_user-guide_html
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-doc_user-guide_user-guide_html	29 Jan 2006 02:00:43 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- doc/user-guide/user-guide.html.orig	Sun Dec  4 13:51:03 2005
++++ doc/user-guide/user-guide.html	Sun Jan 29 13:00:38 2006
+@@ -109,7 +109,7 @@ BitlBee doesn't have any mailinglists.
+ </p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="quickstart"></a>Chapter 4. Quickstart</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#quickstart2">Add and Connect To your IM Account(s)</a></span></dt><dt><span class="sect1"><a href="#quickstart3">Managing Contact Lists: Rename</a></span></dt><dt><span class="sect1"><a href="#quickstart4">Step Four: Managing Contact Lists: Add and Remove.</a></span></dt><dt><span class="sect1"><a href="#quickstart5">Chatting</a></span></dt><dt><span class="sect1"><a href="#quickstart6">Further Resources</a></span></dt></dl></div><p>
+ Welcome to BitlBee, your IRC gateway to ICQ, MSN, AOL, Jabber and Yahoo Instant Messaging Systems.
+ </p><p>
+-The center of BitlBee is the control channel, <span class="emphasis"><em>&amp;bitlbee</em></span>. Two users will always be there, <span class="emphasis"><em>you</em></span> (where "you" is the nickname you are using) and the system user, <span class="emphasis"><em>root</em></span>.
++The center of BitlBee is the control channel, <span class="emphasis"><em>&amp;bitlbee</em></span>. Two users will always be there, <span class="emphasis"><em>you</em></span> (where "you" is the nickname you are using) and the system user, <span class="emphasis"><em>root</em></span>. Your installation may have redefined <span class="emphasis"><em>root</em></span>, e.g. to <span class="emphasis"><em>bitlbee</em></span>.
+ </p><p>
+ You need register so that all your IM settings (passwords, contacts, etc) can be saved on the BitlBee server. It's important that you pick a good password so no one else can access your account. Register with this password using the <span class="emphasis"><em>register</em></span> command: <span class="emphasis"><em>register &lt;password&gt;</em></span> (without the brackets!).
+ </p><p>
Index: patches/patch-help_c
===================================================================
RCS file: patches/patch-help_c
diff -N patches/patch-help_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-help_c	29 Jan 2006 04:47:08 -0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+--- help.c.orig	Fri Nov 18 11:17:04 2005
++++ help.c	Sun Jan 29 15:46:43 2006
+@@ -83,8 +83,7 @@ help_t *help_init( help_t **help )
+ 		}
+ 		h->string = g_new ( char, i );
+ 		
+-		strncpy( h->string, s + 1, i - 1 );
+-		h->string[i-1] = 0;
++		strlcpy( h->string, s + 1, i );
+ 		h->fd = (*help)->fd;
+ 		h->offset.file_offset = lseek( h->fd, 0, SEEK_CUR ) - buflen + i + 1;
+ 		h->length = t - s - i - 1;
+@@ -139,7 +138,7 @@ char *help_get( help_t **help, char *str
+ 		}
+ 		else
+ 		{
+-			strncpy( s, h->offset.mem_offset, h->length );
++			strlcpy( s, h->offset.mem_offset, h->length + 1 );
+ 		}
+ 		return( s );
+ 	}
Index: patches/patch-ini_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-ini_c,v
retrieving revision 1.1
diff -u -w -r1.1 patch-ini_c
--- patches/patch-ini_c	20 Jun 2004 16:27:49 -0000	1.1
+++ patches/patch-ini_c	23 Jan 2006 17:39:46 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-ini_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
---- ini.c.orig	2004-04-05 02:57:31.000000000 +1000
-+++ ini.c	2004-06-08 20:10:54.000000000 +1000
-@@ -47,28 +47,31 @@ int ini_read( ini_t *file )
+--- ini.c.orig	Thu Feb 24 02:47:58 2005
++++ ini.c	Wed Nov  2 11:51:26 2005
+@@ -46,28 +46,31 @@ int ini_read( ini_t *file )
  	while( !feof( file->fp ) )
  	{
  		*s = 0;
@@ -38,7 +38,7 @@
  			for( i = strlen( file->value ) - 1; file->value[i] == 32; i -- )
  				file->value[i] = 0;
  			
-@@ -76,7 +79,7 @@ int ini_read( ini_t *file )
+@@ -75,7 +78,7 @@ int ini_read( ini_t *file )
  		}
  		else if( ( t = strchr( s, '[' ) ) )
  		{
Index: patches/patch-irc_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-irc_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-irc_c
--- patches/patch-irc_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-irc_c	29 Jan 2006 01:42:31 -0000
@@ -1,49 +1,37 @@
 $OpenBSD: patch-irc_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- irc.c.orig	Sat Sep 25 04:48:04 2004
-+++ irc.c	Thu Oct 14 15:43:33 2004
-@@ -44,7 +44,7 @@ irc_t *irc_new( int fd )
- 	
+--- irc.c.orig	Sun Jan 15 02:13:11 2006
++++ irc.c	Sun Jan 29 12:41:13 2006
+@@ -59,7 +59,7 @@ irc_t *irc_new( int fd )
  	irc->userhash = g_hash_table_new( g_str_hash, g_str_equal );
+ 	irc->watches = g_hash_table_new( g_str_hash, g_str_equal );
  	
 -	strcpy( irc->umode, UMODE );
 +	strlcpy( irc->umode, UMODE, sizeof(irc->umode) );
  	irc->mynick = g_strdup( ROOT_NICK );
  	irc->channel = g_strdup( ROOT_CHAN );
  	
-@@ -282,7 +282,7 @@ int irc_fill_buffer( irc_t *irc ) 
+@@ -117,9 +117,9 @@ irc_t *irc_new( int fd )
+ 	set_add( irc, "buddy_sendbuffer_delay", "200", set_eval_int );
+ 	set_add( irc, "charset", "iso8859-1", set_eval_charset );
+ 	set_add( irc, "debug", "false", set_eval_bool );
+-	set_add( irc, "default_target", "root", NULL );
++	set_add( irc, "default_target", ROOT_NICK, NULL );
+ 	set_add( irc, "display_namechanges", "false", set_eval_bool );
+-	set_add( irc, "handle_unknown", "root", NULL );
++	set_add( irc, "handle_unknown", ROOT_NICK, NULL );
+ 	set_add( irc, "lcnicks", "true", set_eval_bool );
+ 	set_add( irc, "ops", "both", set_eval_ops );
+ 	set_add( irc, "private", "true", set_eval_bool );
+@@ -610,7 +610,7 @@ int irc_exec( irc_t *irc, char **cmd )
+ 				
+ 				if( g_strcasecmp( t, "last" ) == 0 && irc->last_target )
+ 					cmd[1] = irc->last_target;
+-				else if( g_strcasecmp( t, "root" ) == 0 )
++				else if( g_strcasecmp( t, ROOT_NICK ) == 0  || g_strcasecmp( t, "root" ) == 0 )
+ 					cmd[1] = irc->mynick;
  	
- 	while( select( irc->fd + 1, readfds, NULL, NULL, tv ) > 0 )
- 	{
--		st = read( irc->fd, line, 255 );
-+		st = read( irc->fd, line, sizeof(line)-1);
- 		if( st <= 0 )
- 			return( 0 );
- 		line[st]='\0';
-@@ -290,8 +290,9 @@ int irc_fill_buffer( irc_t *irc ) 
- 			irc->readbuffer = g_strdup( line );
- 		else 
- 		{
--			irc->readbuffer = bitlbee_realloc(irc->readbuffer, strlen( irc->readbuffer ) + strlen ( line ) + 1 );
--			strcpy( ( irc->readbuffer+strlen( irc->readbuffer ) ), line ); 
-+			size_t new_len  = strlen(irc->readbuffer) + strlen(line) + 1;
-+			irc->readbuffer = bitlbee_realloc(irc->readbuffer, new_len);
-+			strlcat( irc->readbuffer, line, new_len ); 
- 		}
- 	}
- 	return 1;
-@@ -353,8 +354,9 @@ int irc_write_buffer( irc_t *irc ) 
- 		}
- 		else
- 		{
--			temp = bitlbee_alloc( size - st + 1 );
--			strcpy( temp, ( irc->sendbuffer + st ) );
-+			size_t new_len = size - st + 1;
-+			temp = bitlbee_alloc( new_len );
-+			strlcpy( temp, ( irc->sendbuffer + st ), new_len );
- 			g_free( irc->sendbuffer );
- 			irc->sendbuffer = temp;
- 		}
-@@ -718,8 +720,8 @@ int irc_exec( irc_t *irc, char **cmd )
+ 				for( i = 0; i < strlen( cmd[2] ); i ++ )
+@@ -698,8 +698,8 @@ int irc_exec( irc_t *irc, char **cmd )
  				 * cares?
  				 */
  				
@@ -54,7 +42,7 @@
  			}
  		}
  		
-@@ -828,7 +830,7 @@ void irc_reply( irc_t *irc, int code, ch
+@@ -850,7 +850,7 @@ void irc_reply( irc_t *irc, int code, ch
  	va_list params;
  	
  	va_start( params, format );
@@ -63,29 +51,31 @@
  	va_end( params );
  	irc_write( irc, ":%s %03d %s %s", irc->myhost, code, irc->nick?irc->nick:"*", text );
  	
-@@ -871,9 +873,10 @@ void irc_vawrite( irc_t *irc, char *form
- 	if( irc->quit )
- 		return;
- 
--	g_vsnprintf( line, IRC_MAX_LINE - 3, format, params );
-+	/* allow 2 for \r\n */
-+	g_vsnprintf( line, sizeof(line)-2, format, params );
+@@ -897,12 +897,12 @@ void irc_vawrite( irc_t *irc, char *form
+ 	g_vsnprintf( line, IRC_MAX_LINE - 3, format, params );
  
+ 	strip_newlines( line );
 -	strcat( line, "\r\n" );
 +	strlcat( line, "\r\n", sizeof(line) );
  
  	if( irc->sendbuffer != NULL ) {
  		size=strlen( irc->sendbuffer ) + strlen( line );
-@@ -893,7 +896,7 @@ void irc_vawrite( irc_t *irc, char *form
- 		}
- #endif
- 		irc->sendbuffer=bitlbee_realloc( irc->sendbuffer, size + 1 );
+ 		irc->sendbuffer = g_renew ( char, irc->sendbuffer, size + 1 );
 -		strcpy( ( irc->sendbuffer + strlen( irc->sendbuffer ) ), line );
 +		strlcat( irc->sendbuffer, line, size+1 );
  	}
  	else 
  		irc->sendbuffer = g_strdup(line);	
-@@ -1063,15 +1066,19 @@ void irc_motd( irc_t *irc )
+@@ -972,7 +972,7 @@ void irc_names( irc_t *irc, char *channe
+ 			}
+ 			else if( !u->gc )
+ 			{
+-				if( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( set_getstr( irc, "ops" ), "root" ) == 0 || strcmp( set_getstr( irc, "ops" ), "both" ) == 0 ) )
++				if( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( set_getstr( irc, "ops" ), ROOT_NICK ) == 0 || strcmp( set_getstr( irc, "ops" ), "root" ) == 0 || strcmp( set_getstr( irc, "ops" ), "both" ) == 0 ) )
+ 					s = "@";
+ 				else if( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( set_getstr( irc, "ops" ), "user" ) == 0 || strcmp( set_getstr( irc, "ops" ), "both" ) == 0 ) )
+ 					s = "@";
+@@ -1092,15 +1092,19 @@ void irc_motd( irc_t *irc )
  		irc_reply( irc, 375, ":- %s Message Of The Day - ", irc->myhost );
  		while( read( fd, linebuf + len, 1 ) == 1 )
  		{
@@ -108,7 +98,7 @@
  				if( linebuf[len] == 'h' )
  					add = irc->myhost;
  				else if( linebuf[len] == 'v' )
-@@ -1080,14 +1087,30 @@ void irc_motd( irc_t *irc )
+@@ -1109,14 +1113,30 @@ void irc_motd( irc_t *irc )
  					add = irc->nick;
  				else
  					add = "%";
@@ -142,8 +132,8 @@
  		}
  		irc_reply( irc, 376, ":End of MOTD" );
  		closesocket( fd );
-@@ -1361,8 +1384,8 @@ int buddy_send_handler( irc_t *irc, user
- 			u->sendbuf = bitlbee_realloc( u->sendbuf, u->sendbuf_len );
+@@ -1447,8 +1467,8 @@ int buddy_send_handler( irc_t *irc, user
+ 			u->sendbuf = g_renew ( char, u->sendbuf, u->sendbuf_len );
  		}
  		
 -		strcat( u->sendbuf, msg );
@@ -151,14 +141,5 @@
 +		strlcat( u->sendbuf, msg, u->sendbuf_len );
 +		strlcat( u->sendbuf, "\n", u->sendbuf_len );
  		
- 		if( u->sendbuf_timer > 0 )
- 			g_source_remove( u->sendbuf_timer );
-@@ -1426,7 +1449,7 @@ int irc_msgfrom( irc_t *irc, char *nick,
- 	
- 	if( !u->is_private && nick_cmp( u->nick, irc->mynick ) != 0 )
- 	{
--		int len = strlen( irc->nick) + 3;
-+		size_t len = strlen( irc->nick) + 3;
- 		prefix = bitlbee_alloc( len );
- 		g_snprintf( prefix, len, "%s%s", irc->nick, set_getstr( irc, "to_char" ) );
- 		prefix[len-1] = 0;
+ 		delay = set_getint( irc, "buddy_sendbuffer_delay" );
+ 		if( delay <= 5 )
Index: patches/patch-nick_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-nick_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-nick_c
--- patches/patch-nick_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-nick_c	28 Jan 2006 16:39:42 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-nick_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- nick.c.orig	Sun Jul 18 21:13:15 2004
-+++ nick.c	Fri Oct 15 14:31:10 2004
-@@ -66,7 +66,7 @@ char *nick_get( irc_t *irc, char *handle
+--- 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 ) )
@@ -10,7 +10,7 @@
  		else
  			n = n->next;
  	
-@@ -74,7 +74,7 @@ char *nick_get( irc_t *irc, char *handle
+@@ -73,7 +73,7 @@ char *nick_get( irc_t *irc, const char *
  	{
  		char *s;
  		
@@ -19,7 +19,7 @@
  		if( ( s = strchr( nick, '@' ) ) )
  			while( *s )
  				*(s++) = 0;
-@@ -83,7 +83,7 @@ char *nick_get( irc_t *irc, char *handle
+@@ -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 )
@@ -28,7 +28,7 @@
  		
  		nick_strip( nick );
  		if (set_getint(irc, "lcnicks")) 
-@@ -120,7 +120,7 @@ char *nick_get( irc_t *irc, char *handle
+@@ -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_(_at_)_gaast_(_dot_)_net" );
  			
@@ -37,7 +37,7 @@
  			
  			break;
  		}
-@@ -244,8 +244,8 @@ int nick_cmp( char *a, char *b )
+@@ -240,8 +240,8 @@ int nick_cmp( const char *a, const char 
  {
  	char aa[1024] = "", bb[1024] = "";
  	
@@ -48,18 +48,3 @@
  	if( nick_lc( aa ) && nick_lc( bb ) )
  	{
  		return( strcmp( aa, bb ) );
-@@ -259,10 +259,11 @@ int nick_cmp( char *a, char *b )
- char *nick_dup( char *nick )
- {
- 	char *cp;
-+	size_t cp_len = MAX_NICK_LENGTH +1;
- 	
--	cp = bitlbee_alloc( MAX_NICK_LENGTH + 1 );
--	memset( cp, 0, MAX_NICK_LENGTH + 1 );
--	strncpy( cp, nick, MAX_NICK_LENGTH );
-+	cp = bitlbee_alloc( cp_len );
-+	memset( cp, 0, cp_len );
-+	strlcpy( cp, nick, cp_len );
- 	
- 	return( cp );
- }
Index: patches/patch-protocols_jabber_jabber_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_jabber_jabber_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-protocols_jabber_jabber_c
--- patches/patch-protocols_jabber_jabber_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-protocols_jabber_jabber_c	28 Jan 2006 16:39:33 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_jabber_jabber_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- protocols/jabber/jabber.c.orig	Wed Sep  8 06:54:23 2004
-+++ protocols/jabber/jabber.c	Fri Oct 15 14:33:18 2004
-@@ -287,7 +287,7 @@ static char *gjab_getsid(gjconn gjc)
+--- protocols/jabber/jabber.c.orig	Sun Jan 15 02:12:45 2006
++++ protocols/jabber/jabber.c	Sun Jan 29 03:23:00 2006
+@@ -285,7 +285,7 @@ static char *gjab_getsid(gjconn gjc)
  
  static char *gjab_getid(gjconn gjc)
  {
@@ -10,7 +10,7 @@
  	return &gjc->idbuf[0];
  }
  
-@@ -383,10 +383,11 @@ static void gjab_auth(gjconn gjc)
+@@ -381,10 +381,11 @@ static void gjab_auth(gjconn gjc)
  	xmlnode_insert_cdata(z, gjc->user->resource, -1);
  
  	if (gjc->sid) {
@@ -25,7 +25,7 @@
  		hash = shahash(hash);
  		xmlnode_insert_cdata(z, hash, 40);
  	} else {
-@@ -1241,8 +1242,7 @@ static void jabber_handlebuddy(gjconn gj
+@@ -1214,8 +1215,7 @@ static void jabber_handlebuddy(gjconn gj
  					serv_got_update(GJ_GC(gjc), buddyname, 1, 0, signon, idle, uc, 0);
  				}
  			} else if(name != NULL && strcmp(b->show, name)) {
@@ -35,7 +35,7 @@
  				serv_buddy_rename(GJ_GC(gjc), buddyname, b->show);
  			}
  		}
-@@ -1389,7 +1389,7 @@ static void jabber_handlelast(gjconn gjc
+@@ -1358,7 +1358,7 @@ static void jabber_handlelast(gjconn gjc
  	xmlnode_put_attrib(x, "to", from);
  	xmlnode_put_attrib(x, "id", id);
  	querytag = xmlnode_get_tag(x, "query");
@@ -44,7 +44,7 @@
  	xmlnode_put_attrib(querytag, "seconds", idle_time);
  
  	gjab_send(gjc, x);
-@@ -2170,7 +2170,7 @@ static xmlnode insert_tag_to_parent_tag(
+@@ -2135,7 +2135,7 @@ static xmlnode insert_tag_to_parent_tag(
  			/*
  			 * Descend?
  			 */
Index: patches/patch-protocols_msn_ns_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_msn_ns_c,v
retrieving revision 1.1
diff -u -w -r1.1 patch-protocols_msn_ns_c
--- patches/patch-protocols_msn_ns_c	20 Jun 2004 16:27:49 -0000	1.1
+++ patches/patch-protocols_msn_ns_c	23 Jan 2006 17:39:46 -0000
@@ -1,9 +1,12 @@
 $OpenBSD: patch-protocols_msn_ns_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
---- protocols/msn/ns.c.orig	2004-05-15 23:00:53.000000000 +1000
-+++ protocols/msn/ns.c	2004-06-09 22:01:38.000000000 +1000
-@@ -218,8 +218,7 @@ static int msn_ns_command( gpointer data
+--- protocols/msn/ns.c.orig	Fri Jun  3 11:15:35 2005
++++ protocols/msn/ns.c	Tue Nov  1 21:26:47 2005
+@@ -216,10 +216,9 @@ static int msn_ns_command( gpointer data
+ 		}
+ 		else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 )
  		{
- 			http_decode( cmd[4] );
+-			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;
@@ -11,7 +14,16 @@
  			
  			set_login_progress( gc, 1, "Authenticated, getting buddy list" );
  			
-@@ -342,7 +341,7 @@ static int msn_ns_command( gpointer data
+@@ -291,7 +290,7 @@ static int msn_ns_command( gpointer data
+ 			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
  		
  		g_snprintf( buf, sizeof( buf ), "QRY %d %s %d\r\n", ++md->trId, QRY_NAME, 32 );
  		for( i = 0; i < 16; i ++ )
@@ -20,13 +32,48 @@
  		
  		return( msn_write( gc, buf, strlen( buf ) ) );
  	}
-@@ -502,8 +501,7 @@ static int msn_ns_command( gpointer data
+@@ -373,7 +372,7 @@ static int msn_ns_command( gpointer data
+ 			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
+ 			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
+ 		{
+ 			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
+ 		
  		if( g_strcasecmp( cmd[3], gc->username ) == 0 )
  		{
- 			http_decode( cmd[4] );
+-			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] );
+ 		}
+ 	}
Index: patches/patch-protocols_msn_sb_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_msn_sb_c,v
retrieving revision 1.1
diff -u -w -r1.1 patch-protocols_msn_sb_c
--- patches/patch-protocols_msn_sb_c	20 Jun 2004 16:27:49 -0000	1.1
+++ patches/patch-protocols_msn_sb_c	28 Jan 2006 16:39:34 -0000
@@ -1,21 +1,21 @@
 $OpenBSD: patch-protocols_msn_sb_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
---- protocols/msn/sb.c.orig	2004-04-25 19:52:35.000000000 +1000
-+++ protocols/msn/sb.c	2004-06-09 19:18:09.000000000 +1000
-@@ -122,10 +122,11 @@ int msn_sb_sendmessage( struct msn_switc
- 	if( sb->ready )
+--- protocols/msn/sb.c.orig	Sun Jan 15 02:13:02 2006
++++ protocols/msn/sb.c	Sun Jan 29 03:23:00 2006
+@@ -126,10 +126,11 @@ int msn_sb_sendmessage( struct msn_switc
+ 		
+ 		if( strcmp( text, TYPING_NOTIFICATION_MESSAGE ) != 0 )
  	{
- 		char cmd[1024];
--		char *buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 );
+-			buf = g_new0( char, sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2 );
 +		size_t buf_len = sizeof( MSN_MESSAGE_HEADERS ) + strlen( text ) * 2;
-+		char *buf = g_new0( char, buf_len);
- 		int i = strlen( MSN_MESSAGE_HEADERS ), j;
++			buf = g_new0( char, buf_len);
+ 			i = strlen( MSN_MESSAGE_HEADERS );
  		
 -		strcpy( buf, MSN_MESSAGE_HEADERS );
 +		strlcpy( buf, MSN_MESSAGE_HEADERS, buf_len );
  		for( j = 0; text[j]; j ++ )
  		{
  			if( text[j] == '\n' )
-@@ -592,7 +593,7 @@ static int msn_sb_message( gpointer data
+@@ -627,7 +628,7 @@ static int msn_sb_message( gpointer data
  				}
  				else
  				{
Index: patches/patch-protocols_nogaim_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_nogaim_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-protocols_nogaim_c
--- patches/patch-protocols_nogaim_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-protocols_nogaim_c	29 Jan 2006 02:12:35 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_nogaim_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- protocols/nogaim.c.orig	Wed Sep  8 06:52:47 2004
-+++ protocols/nogaim.c	Thu Oct 14 15:43:34 2004
-@@ -442,8 +442,8 @@ void add_buddy( struct gaim_connection *
+--- protocols/nogaim.c.orig	Sun Jan 15 02:05:16 2006
++++ protocols/nogaim.c	Sun Jan 29 13:12:08 2006
+@@ -428,8 +428,8 @@ void add_buddy( struct gaim_connection *
  		/* Buddy seems to exist already. Let's ignore this request then... */
  	}
  	
@@ -12,7 +12,7 @@
  	
  	u = user_add( gc->irc, nick );
  	
-@@ -487,8 +487,8 @@ struct buddy *find_buddy( struct gaim_co
+@@ -474,8 +474,8 @@ struct buddy *find_buddy( struct gaim_co
  		return( NULL );
  
  	memset( b, 0, sizeof( b ) );
@@ -23,21 +23,21 @@
  	b->present = u->online;
  	b->gc = u->gc;
  	
-@@ -800,8 +800,11 @@ struct conversation *serv_got_joined_cha
+@@ -801,8 +801,11 @@ struct conversation *serv_got_joined_cha
  	c->gc = gc;
  	c->title = g_strdup( handle );
  	
--	s = bitlbee_alloc( 16 );
--	sprintf( s, "#chat_%03d", gc->irc->c_id++ );
+-	s = g_new( char, 16 );
+-	sprintf( s, "&chat_%03d", gc->irc->c_id++ );
 +	{
 +		size_t s_len = 16;
-+		s = bitlbee_alloc( s_len);
-+		g_snprintf( s, s_len, "#chat_%03d", gc->irc->c_id++ );
++		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 );
  	
-@@ -977,7 +980,7 @@ char *set_eval_away_devoice( irc_t *irc,
+@@ -978,7 +981,7 @@ char *set_eval_away_devoice( irc_t *irc,
  					count = 0;
  				}
  				
@@ -46,3 +46,30 @@
  				count ++;
  			}
  			u = u->next;
+@@ -1006,7 +1009,7 @@ int serv_send_im( irc_t *irc, user_t *u,
+ 		char *html;
+ 		
+ 		html = escape_html( msg );
+-		strncpy( buf, html, 8192 );
++		strlcpy( buf, html, sizeof(buf) );
+ 		g_free( html );
+ 		
+ 		msg = buf;
+@@ -1025,7 +1028,7 @@ int serv_send_chat( irc_t *irc, struct g
+ 
+ 	if( gc->flags & OPT_CONN_HTML) {
+ 		char * html = escape_html(msg);
+-		strncpy(buf, html, 8192);
++		strlcpy(buf, html, sizeof(buf));
+ 		g_free(html);
+ 	}
+ 	
+@@ -1046,7 +1049,7 @@ signed int do_iconv( char *from_cs, char
+ 	iconv_t cd;
+ 	size_t res;
+ 	size_t inbytesleft, outbytesleft;
+-	char *inbuf = src;
++	const char *inbuf = src;
+ 	char *outbuf = dst;
+ 	
+ 	cd = iconv_open( to_cs, from_cs );
Index: patches/patch-protocols_oscar_admin_c
===================================================================
RCS file: patches/patch-protocols_oscar_admin_c
diff -N patches/patch-protocols_oscar_admin_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_admin_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/admin.c.orig	Thu Mar 24 00:38:46 2005
++++ protocols/oscar/admin.c	Tue Nov  1 21:54:16 2005
+@@ -80,7 +80,7 @@ int admin_modfirst(aim_session_t *sess, 
+ 	mod->toolid = AIM_TOOL_NEWWIN;
+ 	mod->toolversion = 0x0629; 
+ 	mod->flags = 0;
+-	strncpy(mod->name, "admin", sizeof(mod->name));
++	strlcpy(mod->name, "admin", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_auth_c
===================================================================
RCS file: patches/patch-protocols_oscar_auth_c
diff -N patches/patch-protocols_oscar_auth_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_auth_c	28 Jan 2006 16:39:35 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- protocols/oscar/auth.c.orig	Fri Nov 18 11:17:05 2005
++++ protocols/oscar/auth.c	Sun Jan 29 03:23:00 2006
+@@ -395,7 +395,7 @@ static int parse(aim_session_t *sess, ai
+ 	memset(sess->sn, 0, sizeof(sess->sn));
+ 	if (aim_gettlv(tlvlist, 0x0001, 1)) {
+ 		info.sn = aim_gettlv_str(tlvlist, 0x0001, 1);
+-		strncpy(sess->sn, info.sn, sizeof(sess->sn));
++		strlcpy(sess->sn, info.sn, sizeof(sess->sn));
+ 	}
+ 
+ 	/*
+@@ -529,7 +529,7 @@ int auth_modfirst(aim_session_t *sess, a
+ 	mod->family = 0x0017;
+ 	mod->version = 0x0000;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "auth", sizeof(mod->name));
++	strlcpy(mod->name, "auth", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_bos_c
===================================================================
RCS file: patches/patch-protocols_oscar_bos_c
diff -N patches/patch-protocols_oscar_bos_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_bos_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/bos.c.orig	Thu Mar 24 00:38:46 2005
++++ protocols/oscar/bos.c	Tue Nov  1 22:03:38 2005
+@@ -152,7 +152,7 @@ int bos_modfirst(aim_session_t *sess, ai
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "bos", sizeof(mod->name));
++	strlcpy(mod->name, "bos", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_buddylist_c
===================================================================
RCS file: patches/patch-protocols_oscar_buddylist_c
diff -N patches/patch-protocols_oscar_buddylist_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_buddylist_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/buddylist.c.orig	Thu Mar 24 00:38:46 2005
++++ protocols/oscar/buddylist.c	Tue Nov  1 22:03:24 2005
+@@ -85,7 +85,7 @@ int buddylist_modfirst(aim_session_t *se
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "buddylist", sizeof(mod->name));
++	strlcpy(mod->name, "buddylist", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_chat_c
===================================================================
RCS file: patches/patch-protocols_oscar_chat_c
diff -N patches/patch-protocols_oscar_chat_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_chat_c	28 Jan 2006 16:39:35 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- protocols/oscar/chat.c.orig	Sun Jan 15 02:04:28 2006
++++ protocols/oscar/chat.c	Sun Jan 29 03:23:00 2006
+@@ -204,7 +204,7 @@ int aim_chat_join(aim_session_t *sess, a
+ 
+ 	memset(&csi, 0, sizeof(csi));
+ 	csi.exchange = exchange;
+-	strncpy(csi.name, roomname, sizeof(csi.name));
++	strlcpy(csi.name, roomname, sizeof(csi.name));
+ 	csi.instance = instance;
+ 
+ 	snacid = aim_cachesnac(sess, 0x0001, 0x0004, 0x0000, &csi, sizeof(csi));
+@@ -681,7 +681,7 @@ int chat_modfirst(aim_session_t *sess, a
+ 	mod->toolid = 0x0010;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "chat", sizeof(mod->name));
++	strlcpy(mod->name, "chat", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_chatnav_c
===================================================================
RCS file: patches/patch-protocols_oscar_chatnav_c
diff -N patches/patch-protocols_oscar_chatnav_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_chatnav_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/chatnav.c.orig	Thu Mar 24 00:38:46 2005
++++ protocols/oscar/chatnav.c	Tue Nov  1 22:02:48 2005
+@@ -414,7 +414,7 @@ int chatnav_modfirst(aim_session_t *sess
+ 	mod->toolid = 0x0010;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "chatnav", sizeof(mod->name));
++	strlcpy(mod->name, "chatnav", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_conn_c
===================================================================
RCS file: patches/patch-protocols_oscar_conn_c
diff -N patches/patch-protocols_oscar_conn_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_conn_c	28 Jan 2006 16:39:35 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/conn.c.orig	Mon Nov 21 03:27:39 2005
++++ protocols/oscar/conn.c	Sun Jan 29 03:23:00 2006
+@@ -446,7 +446,7 @@ aim_conn_t *aim_newconn(aim_session_t *s
+ 	}
+ 
+ 	host = (char *)g_malloc(i+1);
+-	strncpy(host, dest, i);
++	strlcpy(host, dest, i+1);
+ 	host[i] = '\0';
+ 
+ 	connstruct->fd = proxy_connect(host, port, NULL, NULL);
Index: patches/patch-protocols_oscar_icq_c
===================================================================
RCS file: patches/patch-protocols_oscar_icq_c
diff -N patches/patch-protocols_oscar_icq_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_icq_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/icq.c.orig	Thu Mar 24 00:38:46 2005
++++ protocols/oscar/icq.c	Tue Nov  1 22:01:32 2005
+@@ -432,7 +432,7 @@ int icq_modfirst(aim_session_t *sess, ai
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x047c;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "icq", sizeof(mod->name));
++	strlcpy(mod->name, "icq", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_im_c
===================================================================
RCS file: patches/patch-protocols_oscar_im_c
diff -N patches/patch-protocols_oscar_im_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_im_c	28 Jan 2006 16:39:36 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/im.c.orig	Sun Jan 15 02:04:29 2006
++++ protocols/oscar/im.c	Sun Jan 29 03:23:14 2006
+@@ -2134,7 +2134,7 @@ int msg_modfirst(aim_session_t *sess, ai
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "messaging", sizeof(mod->name));
++	strlcpy(mod->name, "messaging", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_info_c
===================================================================
RCS file: patches/patch-protocols_oscar_info_c
diff -N patches/patch-protocols_oscar_info_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_info_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- protocols/oscar/info.c.orig	Mon Sep 12 03:21:52 2005
++++ protocols/oscar/info.c	Tue Nov  1 22:01:08 2005
+@@ -26,7 +26,7 @@ int aim_getinfo(aim_session_t *sess, aim
+ 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
+ 		return -ENOMEM;
+ 
+-	strncpy(privdata.sn, sn, sizeof(privdata.sn));
++	strlcpy(privdata.sn, sn, sizeof(privdata.sn));
+ 	privdata.infotype = infotype;
+ 	snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, &privdata, sizeof(struct aim_priv_inforeq));
+ 	
+@@ -718,7 +718,7 @@ int locate_modfirst(aim_session_t *sess,
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "locate", sizeof(mod->name));
++	strlcpy(mod->name, "locate", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_misc_c
===================================================================
RCS file: patches/patch-protocols_oscar_misc_c
diff -N patches/patch-protocols_oscar_misc_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_misc_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,33 @@
+$OpenBSD$
+--- protocols/oscar/misc.c.orig	Sun Oct 10 21:24:06 2004
++++ protocols/oscar/misc.c	Tue Nov  1 22:00:53 2005
+@@ -32,9 +32,11 @@ int aim_bos_setbuddylist(aim_session_t *
+ 	int len = 0;
+ 	char *localcpy = NULL;
+ 	char *tmpptr = NULL;
++	size_t	sizeof_localcpy;
+ 
+ 	if (!buddy_list || !(localcpy = g_strdup(buddy_list))) 
+ 		return -EINVAL;
++	sizeof_localcpy = strlen(localcpy)+1;
+ 
+ 	for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {
+ 		len += 1 + strlen(tmpptr);
+@@ -47,7 +49,7 @@ int aim_bos_setbuddylist(aim_session_t *
+ 	snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, NULL, 0);
+ 	aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid);
+ 
+-	strncpy(localcpy, buddy_list, strlen(buddy_list) + 1);
++	strlcpy(localcpy, buddy_list, sizeof_localcpy);
+ 
+ 	for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {
+ 
+@@ -387,7 +389,7 @@ int misc_modfirst(aim_session_t *sess, a
+ 	mod->family = 0xffff;
+ 	mod->version = 0x0000;
+ 	mod->flags = AIM_MODFLAG_MULTIFAMILY;
+-	strncpy(mod->name, "misc", sizeof(mod->name));
++	strlcpy(mod->name, "misc", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_oscar_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_oscar_oscar_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-protocols_oscar_oscar_c
--- patches/patch-protocols_oscar_oscar_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-protocols_oscar_oscar_c	28 Jan 2006 16:39:36 -0000
@@ -1,7 +1,16 @@
 $OpenBSD: patch-protocols_oscar_oscar_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- protocols/oscar/oscar.c.orig	Sat Sep 25 21:30:31 2004
-+++ protocols/oscar/oscar.c	Fri Oct 15 14:34:08 2004
-@@ -297,7 +297,7 @@ static void oscar_callback(gpointer data
+--- protocols/oscar/oscar.c.orig	Sun Jan 15 02:05:16 2006
++++ protocols/oscar/oscar.c	Sun Jan 29 03:39:18 2006
+@@ -146,7 +146,7 @@ static char *extract_name(const char *na
+ 			tmp[j++] = x[i];
+ 			continue;
+ 		}
+-		strncpy(hex, x + ++i, 2); hex[2] = 0;
++		strlcpy(hex, x + ++i, sizeof(hex));
+ 		i++;
+ 		tmp[j++] = (char)strtol(hex, NULL, 16);
+ 	}
+@@ -291,7 +291,7 @@ static void oscar_callback(gpointer data
  					c->inpa = 0;
  					c->fd = -1;
  					aim_conn_kill(odata->sess, &conn);
@@ -10,7 +19,7 @@
  					do_error_dialog(sess->aux_data, buf, _("Chat Error!"));
  				} else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
  					if (odata->cnpa > 0)
-@@ -1353,7 +1353,7 @@ static int gaim_parse_msgerr(aim_session
+@@ -1360,7 +1360,7 @@ static int gaim_parse_msgerr(aim_session
  	destn = va_arg(ap, char *);
  	va_end(ap);
  
@@ -19,7 +28,7 @@
  			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
  	do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
  
-@@ -1371,7 +1371,7 @@ static int gaim_parse_locerr(aim_session
+@@ -1378,7 +1378,7 @@ static int gaim_parse_locerr(aim_session
  	destn = va_arg(ap, char *);
  	va_end(ap);
  
@@ -28,3 +37,12 @@
  			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
  	do_error_dialog(sess->aux_data, buf, _("Gaim - Error"));
  
+@@ -2381,7 +2381,7 @@ static char *oscar_encoding_to_utf8(char
+ 	 * that was specified.  So we assume it's UTF-8 and hope for the best.
+ 	 */
+ 	if (*utf8 == 0) {
+-	    strncpy(utf8, text, textlen);
++	    strlcpy(utf8, text, 8192);
+ 	}
+ 
+ 	return utf8;
Index: patches/patch-protocols_oscar_oscar_util_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_oscar_oscar_util_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-protocols_oscar_oscar_util_c
--- patches/patch-protocols_oscar_oscar_util_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-protocols_oscar_oscar_util_c	28 Jan 2006 16:39:37 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_oscar_oscar_util_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- protocols/oscar/oscar_util.c.orig	Wed Apr 28 01:36:33 2004
-+++ protocols/oscar/oscar_util.c	Thu Oct 14 15:43:35 2004
-@@ -86,8 +86,7 @@ char *aimutil_itemidx(char *toSearch, in
+--- protocols/oscar/oscar_util.c.orig	Fri Nov 18 11:17:07 2005
++++ protocols/oscar/oscar_util.c	Sun Jan 29 03:23:14 2006
+@@ -80,8 +80,7 @@ char *aimutil_itemidx(char *toSearch, in
  		toReturn = g_strdup("");
  	} else {
  		if (next == NULL) {
Index: patches/patch-protocols_oscar_search_c
===================================================================
RCS file: patches/patch-protocols_oscar_search_c
diff -N patches/patch-protocols_oscar_search_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_search_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/search.c.orig	Sun Oct 10 21:24:06 2004
++++ protocols/oscar/search.c	Tue Nov  1 21:55:55 2005
+@@ -112,7 +112,7 @@ int search_modfirst(aim_session_t *sess,
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "search", sizeof(mod->name));
++	strlcpy(mod->name, "search", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_service_c
===================================================================
RCS file: patches/patch-protocols_oscar_service_c
diff -N patches/patch-protocols_oscar_service_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_service_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/service.c.orig	Tue Nov  1 04:10:13 2005
++++ protocols/oscar/service.c	Tue Nov  1 21:54:45 2005
+@@ -938,7 +938,7 @@ int general_modfirst(aim_session_t *sess
+ 	mod->toolid = 0x0110;
+ 	mod->toolversion = 0x0629;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "general", sizeof(mod->name));
++	strlcpy(mod->name, "general", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_oscar_ssi_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_oscar_ssi_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-protocols_oscar_ssi_c
--- patches/patch-protocols_oscar_ssi_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-protocols_oscar_ssi_c	23 Jan 2006 17:39:46 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_oscar_ssi_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- protocols/oscar/ssi.c.orig	Wed Sep 22 06:34:44 2004
-+++ protocols/oscar/ssi.c	Thu Oct 14 15:43:35 2004
-@@ -45,11 +45,7 @@ static struct aim_ssi_item *aim_ssi_item
+--- protocols/oscar/ssi.c.orig	Tue Nov  1 04:10:13 2005
++++ protocols/oscar/ssi.c	Tue Nov  1 21:26:48 2005
+@@ -46,11 +46,7 @@ static struct aim_ssi_item *aim_ssi_item
  
  	/* Set the name */
  	if (name) {
@@ -14,7 +14,7 @@
  	} else
  		newitem->name = NULL;
  
-@@ -412,9 +408,7 @@ int aim_ssi_cleanlist(aim_session_t *ses
+@@ -413,9 +409,7 @@ int aim_ssi_cleanlist(aim_session_t *ses
  	if (!cur) {
  		for (parentgroup=sess->ssi.items; ((parentgroup) && (parentgroup->type!=AIM_SSI_TYPE_GROUP) && (parentgroup->gid==0x0000)); parentgroup=parentgroup->next);
  		if (!parentgroup) {
@@ -25,7 +25,21 @@
  			aim_ssi_addgroups(sess, conn, &newgroup, 1);
  		}
  	}
-@@ -1518,7 +1512,7 @@ int ssi_modfirst(aim_session_t *sess, ai
+@@ -1375,9 +1369,10 @@ int aim_ssi_addmoddel(aim_session_t *ses
+ 			snaclen += strlen(items[i]->name);
+ 			
+ 			if (subtype == AIM_CB_SSI_ADD) {
+-				list = g_realloc(list, listlen + strlen(items[i]->name) + 1);
+-				strcpy(list + listlen, items[i]->name);
+-				listlen += strlen(items[i]->name) + 1;
++				size_t list_newlen = listlen + strlen(items[i]->name) + 1;
++				list = g_realloc(list, list_newlen);
++				strlcat(list, items[i]->name, list_newlen);
++				listlen = list_newlen;
+ 			}
+ 		} else {
+ 			if (subtype == AIM_CB_SSI_ADD) {
+@@ -1515,7 +1510,7 @@ int ssi_modfirst(aim_session_t *sess, ai
  	mod->toolid = 0x0110;
  	mod->toolversion = 0x0629;
  	mod->flags = 0;
Index: patches/patch-protocols_oscar_stats_c
===================================================================
RCS file: patches/patch-protocols_oscar_stats_c
diff -N patches/patch-protocols_oscar_stats_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_oscar_stats_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- protocols/oscar/stats.c.orig	Wed Apr 28 01:36:33 2004
++++ protocols/oscar/stats.c	Tue Nov  1 21:54:29 2005
+@@ -31,7 +31,7 @@ int stats_modfirst(aim_session_t *sess, 
+ 	mod->toolid = 0x0104;
+ 	mod->toolversion = 0x0001;
+ 	mod->flags = 0;
+-	strncpy(mod->name, "stats", sizeof(mod->name));
++	strlcpy(mod->name, "stats", sizeof(mod->name));
+ 	mod->snachandler = snachandler;
+ 
+ 	return 0;
Index: patches/patch-protocols_proxy_c
===================================================================
RCS file: patches/patch-protocols_proxy_c
diff -N patches/patch-protocols_proxy_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_proxy_c	28 Jan 2006 16:39:40 -0000
@@ -0,0 +1,38 @@
+$OpenBSD$
+--- protocols/proxy.c.orig	Fri Dec  9 22:59:55 2005
++++ protocols/proxy.c	Sun Jan 29 03:37:58 2006
+@@ -25,6 +25,7 @@
+  , 2nd provide an easy way to add socks support */
+ 
+ #define BITLBEE_CORE
++#include <assert.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -82,6 +83,7 @@ static struct sockaddr_in *gaim_gethostb
+ 			return NULL;
+ 		}
+ 		memset(&sin, 0, sizeof(struct sockaddr_in));
++		assert(hp->h_length <= sizeof(sin.sin_addr.s_addr));
+ 		memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length);
+ 		sin.sin_family = hp->h_addrtype;
+ 	} else
+@@ -406,6 +408,7 @@ static void s5_sendconnect(gpointer data
+ 	buf[2] = 0x00;		/* reserved */
+ 	buf[3] = 0x03;		/* address type -- host name */
+ 	buf[4] = hlen;
++	assert(hlen <= sizeof(buf)-5);
+ 	memcpy(buf + 5, phb->host, hlen);
+ 	buf[5 + strlen(phb->host)] = phb->port >> 8;
+ 	buf[5 + strlen(phb->host) + 1] = phb->port & 0xff;
+@@ -474,8 +477,10 @@ static void s5_canread(gpointer data, gi
+ 		unsigned int i = strlen(proxyuser), j = strlen(proxypass);
+ 		buf[0] = 0x01;	/* version 1 */
+ 		buf[1] = i;
++		assert(i <= sizeof(buf)-2);
+ 		memcpy(buf + 2, proxyuser, i);
+ 		buf[2 + i] = j;
++		assert(j <= sizeof(buf)-2-i-1);
+ 		memcpy(buf + 2 + i + 1, proxypass, j);
+ 		if (write(source, buf, 3 + i + j) < 3 + i + j) {
+ 			close(source);
Index: patches/patch-protocols_util_c
===================================================================
RCS file: patches/patch-protocols_util_c
diff -N patches/patch-protocols_util_c
--- patches/patch-protocols_util_c	21 Oct 2004 14:48:51 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-$OpenBSD: patch-protocols_util_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
---- protocols/util.c.orig	Sat Sep 11 02:03:07 2004
-+++ protocols/util.c	Thu Oct 14 15:43:35 2004
-@@ -131,14 +131,15 @@ char *str_to_utf8(unsigned char *in)
- void strip_linefeed(gchar *text)
- {
- 	int i, j;
--	gchar *text2 = g_malloc(strlen(text) + 1);
-+	size_t text_len = strlen(text) + 1;
-+	gchar *text2 = g_malloc(text_len);
- 
- 	for (i = 0, j = 0; text[i]; i++)
- 		if (text[i] != '\r')
- 			text2[j++] = text[i];
- 	text2[j] = '\0';
- 
--	strcpy(text, text2);
-+	strlcpy(text, text2, text_len);
- 	g_free(text2);
- }
- 
-@@ -239,7 +240,6 @@ char *normalize(const char *s)
- 
- 	u = t = g_strdup(s);
- 
--	strcpy(t, s);
- 	g_strdown(t);
- 
- 	while (*t && (x < BUF_LEN - 1)) {
-@@ -304,7 +304,8 @@ static htmlentity_t ent[] =
- void strip_html( char *in )
- {
- 	char *start = in;
--	char *out = g_malloc( strlen( in ) + 1 );
-+	size_t in_len = strlen( in ) + 1;
-+	char *out = g_malloc(in_len);
- 	char *s = out, *cs;
- 	int i, matched;
- 	
-@@ -363,7 +364,7 @@ void strip_html( char *in )
- 		}
- 	}
- 	
--	strcpy( start, out );
-+	strlcpy( start, out, in_len );
- 	g_free( out );
- } 
- 
Index: patches/patch-protocols_yahoo_crypt_c
===================================================================
RCS file: patches/patch-protocols_yahoo_crypt_c
diff -N patches/patch-protocols_yahoo_crypt_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-protocols_yahoo_crypt_c	28 Jan 2006 16:39:38 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+--- protocols/yahoo/crypt.c.orig	Wed Nov 30 23:07:35 2005
++++ protocols/yahoo/crypt.c	Sun Jan 29 03:23:16 2006
+@@ -155,11 +155,11 @@ char *yahoo_crypt(char *key, char *salt)
+ 	/* Now we can construct the result string.  It consists of three
+ 	   parts.  */
+ 
+-	strncpy(buffer, md5_salt_prefix, MAX (0, buflen));
++	strlcpy(buffer, md5_salt_prefix, MAX (0, buflen));
+ 	cp = buffer + strlen(buffer);
+ 	buflen -= sizeof (md5_salt_prefix);
+ 
+-	strncpy(cp, salt, MIN ((size_t) buflen, salt_len));
++	strlcpy(cp, salt, MIN ((size_t) buflen, salt_len));
+ 	cp = cp + strlen(cp);
+ 	buflen -= MIN ((size_t) buflen, salt_len);
+ 
Index: patches/patch-protocols_yahoo_libyahoo2_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_yahoo_libyahoo2_c,v
retrieving revision 1.3
diff -u -w -r1.3 patch-protocols_yahoo_libyahoo2_c
--- patches/patch-protocols_yahoo_libyahoo2_c	21 Oct 2004 14:48:51 -0000	1.3
+++ patches/patch-protocols_yahoo_libyahoo2_c	28 Jan 2006 16:39:38 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_yahoo_libyahoo2_c,v 1.3 2004/10/21 14:48:51 naddy Exp $
---- protocols/yahoo/libyahoo2.c.orig	Sat Sep 25 21:26:09 2004
-+++ protocols/yahoo/libyahoo2.c	Thu Oct 14 15:43:35 2004
-@@ -638,7 +638,7 @@ static void yahoo_packet_read(struct yah
+--- protocols/yahoo/libyahoo2.c.orig	Wed Nov 30 23:07:40 2005
++++ protocols/yahoo/libyahoo2.c	Sun Jan 29 03:23:16 2006
+@@ -634,7 +634,7 @@ static void yahoo_packet_read(struct yah
  	}
  }
  
@@ -10,7 +10,7 @@
  {
  	YList *l;
  	int pos = 0;
-@@ -648,12 +648,12 @@ static void yahoo_packet_write(struct ya
+@@ -644,12 +644,12 @@ static void yahoo_packet_write(struct ya
  		unsigned char buf[100];
  
  		snprintf((char *)buf, sizeof(buf), "%d", pair->key);
@@ -25,7 +25,7 @@
  		pos += strlen(pair->value);
  		data[pos++] = 0xc0;
  		data[pos++] = 0x80;
-@@ -762,7 +762,7 @@ static void yahoo_send_packet(struct yah
+@@ -758,7 +758,7 @@ static void yahoo_send_packet(struct yah
  	pos += yahoo_put32(data + pos, pkt->status);
  	pos += yahoo_put32(data + pos, pkt->id);
  
@@ -34,7 +34,7 @@
  
  	yahoo_packet_dump(data, len);
  	
-@@ -1561,8 +1561,10 @@ static void yahoo_process_auth_pre_0x0b(
+@@ -1557,8 +1557,10 @@ static void yahoo_process_auth_pre_0x0b(
  	char *crypt_result;
  	unsigned char *password_hash = malloc(25);
  	unsigned char *crypt_hash = malloc(25);
@@ -47,7 +47,7 @@
  	
  	char checksum;
  	
-@@ -1589,37 +1591,37 @@ static void yahoo_process_auth_pre_0x0b(
+@@ -1585,37 +1587,37 @@ static void yahoo_process_auth_pre_0x0b(
  	switch (sv) {
  	case 0:
  		checksum = seed[seed[7] % 16];
@@ -95,7 +95,7 @@
  			"%c%s%s%s", checksum, crypt_hash, seed, yd->user);
  		break;
  	}
-@@ -1945,29 +1947,29 @@ static void yahoo_process_auth_0x0b(stru
+@@ -1941,29 +1943,29 @@ static void yahoo_process_auth_0x0b(stru
  		lookup &= 0x1f;
  		if (lookup >= strlen(alphabet1))
  			break;
@@ -134,7 +134,7 @@
  	}
  
  	/* Our second authentication response is based off 
-@@ -2036,29 +2038,29 @@ static void yahoo_process_auth_0x0b(stru
+@@ -2032,29 +2034,29 @@ static void yahoo_process_auth_0x0b(stru
  		lookup &= 0x1f;
  		if (lookup >= strlen(alphabet1))
  			break;
@@ -173,7 +173,7 @@
  	}
  
  	pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->initial_status, yd->session_id);
-@@ -3079,11 +3081,9 @@ static void yahoo_process_yab_connection
+@@ -3075,11 +3077,9 @@ static void yahoo_process_yab_connection
  				if(yab->nname) {
  					bud->real_name = strdup(yab->nname);
  				} else if(yab->fname && yab->lname) {
@@ -188,7 +188,7 @@
  							yab->fname, yab->lname);
  				} else if(yab->fname) {
  					bud->real_name = strdup(yab->fname);
-@@ -3682,7 +3682,7 @@ void yahoo_get_yab(int id)
+@@ -3678,7 +3678,7 @@ void yahoo_get_yab(int id)
  	yid->yd = yd;
  	yid->type = YAHOO_CONNECTION_YAB;
  
@@ -197,7 +197,7 @@
  
  	snprintf(buff, sizeof(buff), "Y=%s; T=%s",
  			yd->cookie_y, yd->cookie_t);
-@@ -3709,63 +3709,63 @@ void yahoo_set_yab(int id, struct yab * 
+@@ -3705,63 +3705,63 @@ void yahoo_set_yab(int id, struct yab * 
  	yid->type = YAHOO_CONNECTION_YAB;
  	yid->yd = yd;
  
@@ -281,7 +281,7 @@
  
  	snprintf(buff, sizeof(buff), "Y=%s; T=%s",
  			yd->cookie_y, yd->cookie_t);
-@@ -4136,9 +4136,9 @@ void yahoo_get_chatrooms(int id, int cha
+@@ -4132,9 +4132,9 @@ void yahoo_get_chatrooms(int id, int cha
  	yid->type = YAHOO_CONNECTION_CHATCAT;
  
  	if (chatroomid == 0) {
@@ -293,7 +293,7 @@
  	}
  
  	snprintf(buff, sizeof(buff), "Y=%s; T=%s", yd->cookie_y, yd->cookie_t);
-@@ -4373,7 +4373,7 @@ static void yahoo_search_internal(int id
+@@ -4369,7 +4369,7 @@ static void yahoo_search_internal(int id
  	while((p = strchr(ctext, ' ')))
  		*p = '+';
  
Index: patches/patch-protocols_yahoo_yahoo_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_yahoo_yahoo_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-protocols_yahoo_yahoo_c
--- patches/patch-protocols_yahoo_yahoo_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-protocols_yahoo_yahoo_c	28 Jan 2006 16:39:38 -0000
@@ -1,7 +1,7 @@
 $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
+--- protocols/yahoo/yahoo.c.orig	Sun Jan 15 04:09:23 2006
++++ protocols/yahoo/yahoo.c	Sun Jan 29 03:23:16 2006
+@@ -379,8 +379,11 @@ static int byahoo_chat_open( struct gaim
  	char *roomname;
  	YList *members;
  	
@@ -15,7 +15,7 @@
  	
  	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
+@@ -558,13 +561,17 @@ void ext_yahoo_login_response( int id, i
  		
  		if( url && *url )
  		{
@@ -37,7 +37,7 @@
  		}
  		
  		if( yd->logged_in )
-@@ -736,7 +743,7 @@ int ext_yahoo_connect(char *host, int po
+@@ -774,7 +781,7 @@ int ext_yahoo_connect(char *host, int po
  		if(!(server = gethostbyname(host))) {
  			return -1;
  		}
@@ -46,7 +46,15 @@
  	}
  
  	if((servfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-@@ -799,7 +806,7 @@ void ext_yahoo_got_conf_invite( int id, 
+@@ -785,6 +792,7 @@ int ext_yahoo_connect(char *host, int po
+ 	{
+ 		memset(&serv_addr, 0, sizeof(serv_addr));
+ 		serv_addr.sin_family = AF_INET;
++		assert(server->h_length <= sizeof(serv_addr.sin_addr.s_addr));
+ 		memcpy(&serv_addr.sin_addr.s_addr, *p, server->h_length);
+ 		serv_addr.sin_port = htons(port);
+ 
+@@ -837,7 +845,7 @@ void ext_yahoo_got_conf_invite( int id, 
  		if( g_strcasecmp( m->data, gc->username ) != 0 )
  			add_chat_buddy( inv->c, m->data );
  	
Index: patches/patch-protocols_yahoo_yahoo_httplib_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_yahoo_yahoo_httplib_c,v
retrieving revision 1.1
diff -u -w -r1.1 patch-protocols_yahoo_yahoo_httplib_c
--- patches/patch-protocols_yahoo_yahoo_httplib_c	20 Jun 2004 16:27:49 -0000	1.1
+++ patches/patch-protocols_yahoo_yahoo_httplib_c	28 Jan 2006 16:39:39 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_yahoo_yahoo_httplib_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
---- protocols/yahoo/yahoo_httplib.c.orig	2004-03-18 07:21:12.000000000 +1100
-+++ protocols/yahoo/yahoo_httplib.c	2004-06-09 20:32:18.000000000 +1000
-@@ -101,7 +101,7 @@ int yahoo_tcp_readline(char *ptr, int ma
+--- protocols/yahoo/yahoo_httplib.c.orig	Wed Nov 30 23:07:43 2005
++++ protocols/yahoo/yahoo_httplib.c	Sun Jan 29 03:23:16 2006
+@@ -97,7 +97,7 @@ int yahoo_tcp_readline(char *ptr, int ma
  }
  
  static int url_to_host_port_path(const char *url,
@@ -10,7 +10,7 @@
  {
  	char *urlcopy=NULL;
  	char *slash=NULL;
-@@ -136,13 +136,13 @@ static int url_to_host_port_path(const c
+@@ -132,13 +132,13 @@ static int url_to_host_port_path(const c
  	}
  
  	if(!slash) {
@@ -27,7 +27,7 @@
  	
  	FREE(urlcopy);
  
-@@ -159,8 +159,9 @@ char *yahoo_urlencode(const char *instr)
+@@ -155,8 +155,9 @@ char *yahoo_urlencode(const char *instr)
  	int ipos=0, bpos=0;
  	char *str = NULL;
  	int len = strlen(instr);
@@ -38,7 +38,7 @@
  		return "";
  
  	while(instr[ipos]) {
-@@ -169,7 +170,7 @@ char *yahoo_urlencode(const char *instr)
+@@ -165,7 +166,7 @@ char *yahoo_urlencode(const char *instr)
  		if(!instr[ipos])
  			break;
  		
@@ -47,7 +47,7 @@
  		bpos+=3;
  		ipos++;
  	}
-@@ -318,7 +319,7 @@ void yahoo_http_post(int id, const char 
+@@ -314,7 +315,7 @@ void yahoo_http_post(int id, const char 
  	char path[255];
  	char buff[1024];
  	
@@ -56,7 +56,7 @@
  		return;
  
  	snprintf(buff, sizeof(buff), 
-@@ -343,7 +344,7 @@ void yahoo_http_get(int id, const char *
+@@ -339,7 +340,7 @@ void yahoo_http_get(int id, const char *
  	char path[255];
  	char buff[1024];
  	
Index: patches/patch-protocols_yahoo_yahoo_util_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-protocols_yahoo_yahoo_util_c,v
retrieving revision 1.1
diff -u -w -r1.1 patch-protocols_yahoo_yahoo_util_c
--- patches/patch-protocols_yahoo_yahoo_util_c	20 Jun 2004 16:27:49 -0000	1.1
+++ patches/patch-protocols_yahoo_yahoo_util_c	28 Jan 2006 16:39:39 -0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-protocols_yahoo_yahoo_util_c,v 1.1 2004/06/20 16:27:49 naddy Exp $
---- protocols/yahoo/yahoo_util.c.orig	2004-02-09 04:23:29.000000000 +1100
-+++ protocols/yahoo/yahoo_util.c	2004-06-09 20:33:34.000000000 +1000
-@@ -46,11 +46,11 @@ char * y_string_append(char * string, ch
+--- protocols/yahoo/yahoo_util.c.orig	Sun Jan 15 02:12:41 2006
++++ protocols/yahoo/yahoo_util.c	Sun Jan 29 03:23:16 2006
+@@ -42,11 +42,11 @@ char * y_string_append(char * string, ch
  
  	if(new_string == NULL) {
  		new_string = y_new(char, size);
@@ -15,3 +15,12 @@
  
  	return new_string;
  }
+@@ -82,7 +82,7 @@ char ** y_strsplit(char * str, char * se
+ 	for(p=str, s=strstr(p,sep); i<nelem && s; p=s+l, s=strstr(p,sep), i++) {
+ 		int len = s-p;
+ 		vector[i] = y_new(char, len+1);
+-		strncpy(vector[i], p, len);
++		strlcpy(vector[i], p, len+1);
+ 		vector[i][len] = '\0';
+ 	}
+ 
Index: patches/patch-set_c
===================================================================
RCS file: patches/patch-set_c
diff -N patches/patch-set_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-set_c	29 Jan 2006 01:36:47 -0000
@@ -0,0 +1,62 @@
+$OpenBSD$
+--- set.c.orig	Fri Nov 18 11:17:04 2005
++++ set.c	Sun Jan 29 12:30:04 2006
+@@ -35,14 +35,20 @@ set_t *set_add( irc_t *irc, char *key, c
+ 		{
+ 			while( s->next ) s = s->next;
+ 			s->next = g_new ( set_t, 1 );
++			if (!s->next)
++				return NULL;
+ 			s = s->next;
+ 		}
+ 		else
+ 		{
+ 			s = irc->set = g_new( set_t, 1 );
++			if (!s)
++				return NULL;
+ 		}
+ 		memset( s, 0, sizeof( set_t ) );
+ 		s->key = g_strdup( key );
++		if (!s->key)
++			return NULL;
+ 	}
+ 	
+ 	if( s->def )
+@@ -133,7 +139,7 @@ int set_setint( irc_t *irc, char *key, i
+ {
+ 	char s[24];	/* Not quite 128-bit clean eh? ;-) */
+ 	
+-	sprintf( s, "%d", value );
++	snprintf( s, sizeof(s), "%d", value );
+ 	return( set_setstr( irc, key, s ) );
+ }
+ 
+@@ -179,12 +185,16 @@ char *set_eval_bool( irc_t *irc, set_t *
+ 
+ char *set_eval_to_char( irc_t *irc, set_t *set, char *value )
+ {
+-	char *s = g_new( char, 3 );
++	size_t s_len = 3;
++	char *s = g_new( char, s_len );
++
++	if (!s)
++		return NULL;
+ 	
+ 	if( *value == ' ' )
+-		strcpy( s, " " );
++		strlcpy( s, " ", s_len );
+ 	else
+-		sprintf( s, "%c ", *value );
++		g_snprintf( s, s_len, "%c ", *value );
+ 	
+ 	return( s );
+ }
+@@ -197,7 +207,7 @@ char *set_eval_ops( irc_t *irc, set_t *s
+ 		                                              irc->channel, "+o-o", irc->nick, irc->mynick );
+ 		return( value );
+ 	}
+-	else if( g_strcasecmp( value, "root" ) == 0 )
++	else if( g_strcasecmp( value, ROOT_NICK ) == 0  || g_strcasecmp( value, "root" ) == 0 )
+ 	{
+ 		irc_write( irc, ":%s!%s_(_at_)_%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost,
+ 		                                              irc->channel, "-o+o", irc->nick, irc->mynick );
Index: patches/patch-user_c
===================================================================
RCS file: patches/patch-user_c
diff -N patches/patch-user_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-user_c	23 Jan 2006 17:39:46 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- user.c.orig	Thu Nov 18 21:34:31 2004
++++ user.c	Tue Nov  1 21:51:33 2005
+@@ -132,7 +132,7 @@ user_t *user_find( irc_t *irc, char *nic
+ {
+ 	char key[512] = "";
+ 	
+-	strncpy( key, nick, sizeof( key ) - 1 );
++	strlcpy( key, nick, sizeof( key ) );
+ 	if( nick_lc( key ) )
+ 		return( g_hash_table_lookup( irc->userhash, key ) );
+ 	else
Index: patches/patch-util_c
===================================================================
RCS file: patches/patch-util_c
diff -N patches/patch-util_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-util_c	29 Jan 2006 02:24:47 -0000
@@ -0,0 +1,99 @@
+$OpenBSD$
+--- util.c.orig	Sun Jan 15 02:13:11 2006
++++ util.c	Sun Jan 29 13:24:37 2006
+@@ -42,14 +42,15 @@
+ void strip_linefeed(gchar *text)
+ {
+ 	int i, j;
+-	gchar *text2 = g_malloc(strlen(text) + 1);
++	size_t	sizeof_text = strlen(text) + 1;
++	gchar *text2 = g_malloc(sizeof_text);
+ 
+ 	for (i = 0, j = 0; text[i]; i++)
+ 		if (text[i] != '\r')
+ 			text2[j++] = text[i];
+ 	text2[j] = '\0';
+ 
+-	strcpy(text, text2);
++	strlcpy(text, text2, sizeof_text);
+ 	g_free(text2);
+ }
+ 
+@@ -150,7 +151,6 @@ char *normalize(const char *s)
+ 
+ 	u = t = g_strdup(s);
+ 
+-	strcpy(t, s);
+ 	g_strdown(t);
+ 
+ 	while (*t && (x < BUF_LEN - 1)) {
+@@ -218,12 +218,13 @@ static const htmlentity_t ent[] =
+ 
+ void strip_html( char *in )
+ {
++	size_t sizeof_in = strlen(in) + 1;
+ 	char *start = in;
+-	char *out = g_malloc( strlen( in ) + 1 );
++	char *out = g_malloc( sizeof_in );
+ 	char *s = out, *cs;
+ 	int i, matched;
+ 	
+-	memset( out, 0, strlen( in ) + 1 );
++	memset( out, 0, sizeof_in);
+ 	
+ 	while( *in )
+ 	{
+@@ -284,7 +285,7 @@ void strip_html( char *in )
+ 		}
+ 	}
+ 	
+-	strcpy( start, out );
++	strlcpy( start, out, sizeof_in );
+ 	g_free( out );
+ }
+ 
+@@ -333,12 +334,12 @@ void info_string_append(GString *str, ch
+ }
+ 
+ /* Decode%20a%20file%20name						*/
+-void http_decode( char *s )
++void http_decode( char *s, size_t s_len )
+ {
+ 	char *t;
+ 	int i, j, k;
+ 	
+-	t = g_new( char, strlen( s ) + 1 );
++	t = g_new( char, s_len);
+ 	
+ 	for( i = j = 0; s[i]; i ++, j ++ )
+ 	{
+@@ -362,25 +363,25 @@ void http_decode( char *s )
+ 	}
+ 	t[j] = 0;
+ 	
+-	strcpy( s, t );
++	strlcpy( s, t, s_len );
+ 	g_free( t );
+ }
+ 
+ /* Warning: This one explodes the string. Worst-cases can make the string 3x its original size! */
+ /* This fuction is safe, but make sure you call it safely as well! */
+-void http_encode( char *s )
++void http_encode( char *s, size_t s_len )
+ {
+ 	char *t;
+ 	int i, j;
+ 	
+ 	t = g_strdup( s );
+ 	
+-	for( i = j = 0; t[i]; i ++, j ++ )
++	for( i = j = 0; t[i] && j < s_len - 1; i ++, j ++ )
+ 	{
+ 		/* if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' ) */
+ 		if( !isalnum( t[i] ) )
+ 		{
+-			sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] );
++			g_snprintf( s + j, s_len - j, "%%%02X", ((unsigned char*)t)[i] );
+ 			j += 2;
+ 		}
+ 		else
Index: patches/patch-utils_bitlbeed_c
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/patches/patch-utils_bitlbeed_c,v
retrieving revision 1.2
diff -u -w -r1.2 patch-utils_bitlbeed_c
--- patches/patch-utils_bitlbeed_c	21 Oct 2004 14:48:51 -0000	1.2
+++ patches/patch-utils_bitlbeed_c	23 Jan 2006 17:39:46 -0000
@@ -1,7 +1,17 @@
 $OpenBSD: patch-utils_bitlbeed_c,v 1.2 2004/10/21 14:48:51 naddy Exp $
 --- utils/bitlbeed.c.orig	Wed Jul  7 23:27:38 2004
-+++ utils/bitlbeed.c	Thu Oct 14 15:43:35 2004
-@@ -408,14 +408,14 @@ void do_log( char *fmt, ... )
++++ utils/bitlbeed.c	Tue Nov  1 22:07:23 2005
+@@ -120,8 +120,7 @@ int main( int argc, char *argv[] )
+ 	fcntl( serv_fd, F_SETFD, FD_CLOEXEC );
+ 	if (set->local) {
+ 		local_addr.sun_family = AF_LOCAL;
+-		strncpy( local_addr.sun_path, set->interface, sizeof( local_addr.sun_path ) - 1 );
+-		local_addr.sun_path[sizeof( local_addr.sun_path ) - 1] = '\0';
++		strlcpy( local_addr.sun_path, set->interface, sizeof( local_addr.sun_path ) );
+ 		
+ 		/* warning - don't let untrusted users run this program if it
+ 		   is setuid/setgid! Arbitrary file deletion risk! */
+@@ -408,14 +407,14 @@ void do_log( char *fmt, ... )
  	memset( line, 0, MAX_LOG_LEN );
  	
  	tm = time( NULL );
Index: pkg/PLIST
===================================================================
RCS file: /cvs/OpenBSD/ports/net/bitlbee/pkg/PLIST,v
retrieving revision 1.10
diff -u -w -r1.10 PLIST
--- pkg/PLIST	16 Mar 2005 01:57:40 -0000	1.10
+++ pkg/PLIST	23 Jan 2006 17:39:45 -0000
@@ -10,10 +10,10 @@
 share/doc/bitlbee/user-guide.html
 share/examples/bitlbee/
 share/examples/bitlbee/bitlbee.conf
+share/examples/bitlbee/motd.txt
 @sample ${SYSCONFDIR}/bitlbee/
 @sample ${SYSCONFDIR}/bitlbee/bitlbee.conf
-share/examples/bitlbee/motd.txt
 @owner _bitlbee
 @group _bitlbee
-_(_at_)_sample /var/bitlbee/
-_(_at_)_extraunexec rm -rf /var/bitlbee/*
+_(_at_)_sample ${DB_DIR}/
+_(_at_)_extraunexec rm -rf ${DB_DIR}/