X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fclient.c;h=9d736d49540ec141a2b02cee16c0faaf0e1cc64c;hp=6ca7f68706b072381f5fb87099ad10856d3654b1;hb=b316c380ad30a1c23c768544541b7cf56bf9fc0f;hpb=0ced4181b032249a5ccab2a6ae1d61bf08f60293 diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 6ca7f687..9d736d49 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: client.c,v 1.68 2002/12/26 16:25:43 alex Exp $"; +static char UNUSED id[] = "$Id: client.c,v 1.71 2002/12/26 17:14:48 alex Exp $"; #include "imp.h" #include @@ -86,7 +86,7 @@ Client_Init( VOID ) gethostname( This_Server->host, CLIENT_HOST_LEN ); h = gethostbyname( This_Server->host ); - if( h ) strcpy( This_Server->host, h->h_name ); + if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host )); Client_SetID( This_Server, Conf_ServerName ); Client_SetInfo( This_Server, Conf_ServerInfo ); @@ -175,7 +175,7 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR * if( Type == CLIENT_SERVER ) Generate_MyToken( client ); /* ist der User away? */ - if( strchr( client->modes, 'a' )) strcpy( client->away, DEFAULT_AWAY_MSG ); + if( strchr( client->modes, 'a' )) strlcpy( client->away, DEFAULT_AWAY_MSG, sizeof( client->away )); /* Verketten */ client->next = (POINTER *)My_Clients; @@ -203,7 +203,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ) if( ! txt ) txt = "Reason unknown."; /* Netz-Split-Nachricht vorbereiten (noch nicht optimal) */ - if( Client->type == CLIENT_SERVER ) sprintf( msg, "%s: lost server %s", This_Server->id, Client->id ); + if( Client->type == CLIENT_SERVER ) snprintf( msg, sizeof( msg ), "%s: lost server %s", This_Server->id, Client->id ); last = NULL; c = My_Clients; @@ -465,7 +465,7 @@ Client_ModeAdd( CLIENT *Client, CHAR Mode ) if( ! strchr( Client->modes, x[0] )) { /* Client hat den Mode noch nicht -> setzen */ - strcat( Client->modes, x ); + strlcat( Client->modes, x, sizeof( Client->modes )); return TRUE; } else return FALSE; @@ -799,7 +799,7 @@ Client_CheckID( CLIENT *Client, CHAR *ID ) if( strcasecmp( c->id, ID ) == 0 ) { /* die Server-ID gibt es bereits */ - sprintf( str, "ID \"%s\" already registered", ID ); + snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID ); if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id ); else Log( LOG_ERR, "%s (via network)!", str ); Conn_Close( Client->conn_id, str, str, TRUE );