commit - 6626395c88fc46eeb110942b17eb9245a1d0021b
commit + 695631b2984111a825346396dc56635a2fe3a7c4
blob - 70f6be6c704dc94fb73daf855226f4b5b1bd90d6
blob + f4adf0ee65af51f79c006045b164391251f326d0
--- src/ngircd/client.c
+++ src/ngircd/client.c
#include "portab.h"
-static char UNUSED id[] = "$Id: client.c,v 1.69 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: client.c,v 1.70 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
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 );
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;
blob - c2478b8eb0c99d36689a1ad5e2573863d2485f5f
blob + 50c9ee1b2c6c764eb1098a1651ed1c26d1d20646
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
#include "portab.h"
-static char UNUSED id[] = "$Id: conf.c,v 1.50 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: conf.c,v 1.51 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
/* Is this the beginning of a new section? */
if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
{
- strcpy( section, str );
+ strlcpy( section, str, sizeof( section ));
if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
if( strcasecmp( section, "[OPERATOR]" ) == 0 )
{
blob - 43625fe0d22c85ccb76f8226fdcc2cf7cad9629e
blob + 95e6d545fd97fb1930f18fec3858a47cc8b9993b
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
#include "portab.h"
-static char UNUSED id[] = "$Id: conn.c,v 1.108 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.109 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
Log( LOG_INFO, "Accepted connection %d from %s:%d on socket %d.", idx, inet_ntoa( new_addr.sin_addr ), ntohs( new_addr.sin_port), Sock );
/* Hostnamen ermitteln */
- strcpy( My_Connections[idx].host, inet_ntoa( new_addr.sin_addr ));
+ strlcpy( My_Connections[idx].host, inet_ntoa( new_addr.sin_addr ), sizeof( My_Connections[idx].host ));
Client_SetHostname( c, My_Connections[idx].host );
s = Resolve_Addr( &new_addr );
if( s )
/* Hostnamen in IP aufloesen (Default bzw. im Fehlerfall: versuchen, den
* konfigurierten Text direkt als IP-Adresse zu verwenden ... */
- strcpy( Conf_Server[My_Connections[idx].our_server].ip, Conf_Server[i].host );
- strcpy( My_Connections[idx].host, Conf_Server[i].host );
+ strlcpy( Conf_Server[My_Connections[idx].our_server].ip, Conf_Server[i].host, sizeof( Conf_Server[My_Connections[idx].our_server].ip ));
+ strlcpy( My_Connections[idx].host, Conf_Server[i].host, sizeof( My_Connections[idx].host ));
s = Resolve_Name( Conf_Server[i].host );
if( s )
{
/* Verbindung registrieren */
My_Connections[Idx].sock = new_sock;
My_Connections[Idx].addr = new_addr;
- strcpy( My_Connections[Idx].host, Conf_Server[Server].host );
+ strlcpy( My_Connections[Idx].host, Conf_Server[Server].host, sizeof( My_Connections[Idx].host ));
/* Neuen Socket registrieren */
FD_SET( new_sock, &My_Sockets );
/* Eingehende Verbindung: Hostnamen setzen */
c = Client_GetFromConn( i );
assert( c != NULL );
- strcpy( My_Connections[i].host, result );
+ strlcpy( My_Connections[i].host, result, sizeof( My_Connections[i].host ));
Client_SetHostname( c, result );
}
else
{
/* Ausgehende Verbindung (=Server): IP setzen */
assert( My_Connections[i].our_server > NONE );
- strcpy( Conf_Server[My_Connections[i].our_server].ip, result );
+ strlcpy( Conf_Server[My_Connections[i].our_server].ip, result, sizeof( Conf_Server[My_Connections[i].our_server].ip ));
}
/* Penalty-Zeit zurueck setzen */
blob - 926d345e9dbf5267302e6a59a0699afb33e01f21
blob + 7c83ba0fcaec1db02eacbdde0067e1efa559c41d
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
#include "portab.h"
-static char UNUSED id[] = "$Id: irc-channel.c,v 1.21 2002/12/16 23:06:46 alex Exp $";
+static char UNUSED id[] = "$Id: irc-channel.c,v 1.22 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
if(( strchr( Channel_Modes( chan ), 'P' )) && ( strchr( Client_Modes( target ), 'o' ))) Channel_UserModeAdd( chan, target, 'o' );
/* Muessen Modes an andere Server gemeldet werden? */
- strcpy( &modes[1], Channel_UserModes( chan, target ));
+ strlcpy( &modes[1], Channel_UserModes( chan, target ), sizeof( modes ) - 1 );
if( modes[1] ) modes[0] = 0x7;
else modes[0] = '\0';
blob - c5eeadfb5e87938e29fbb2a6c268529f918c5af1
blob + 4827c03fbdebd41b3742527a994963b03ce5d960
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
#include "portab.h"
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.25 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.26 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
{
Channel_ModeDel( Channel, 'k' );
Channel_SetKey( Channel, Req->argv[arg_arg] );
- strcpy( argadd, Channel_Key( Channel ));
+ strlcpy( argadd, Channel_Key( Channel ), sizeof( argadd ));
x[0] = *mode_ptr;
}
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
blob - 6a6f4712febfcfc632a22f27aa111dcf7c289cae
blob + 93ae5ee174bf13ed3b2e6317647f7208a4610087
--- src/ngircd/irc-server.c
+++ src/ngircd/irc-server.c
#include "portab.h"
-static char UNUSED id[] = "$Id: irc-server.c,v 1.26 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: irc-server.c,v 1.27 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame );
/* Channel-User-Modes setzen */
- strcpy( modes, Channel_UserModes( chan, c ));
+ strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes ));
if( modes[0] )
{
/* Modes im Channel bekannt machen */
blob - 5480efbde4647b7d8ad6bcf11fffc88205adb52a
blob + 415c55fbabc823a334eeb079189745852aaf121f
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
#include "portab.h"
-static char UNUSED id[] = "$Id: irc.c,v 1.107 2002/12/12 12:24:18 alex Exp $";
+static char UNUSED id[] = "$Id: irc.c,v 1.108 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
/* build reason string */
if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
- else strcpy( reason, Req->argv[1] );
+ else strlcpy( reason, Req->argv[1], sizeof( reason ));
/* andere Server benachrichtigen */
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
blob - cef1cff58d5b6690b03b3dfdcfdb027aa33134d4
blob + 473ecfc6775d7b614cfc23789d97d91cf39b3c9a
--- src/ngircd/ngircd.c
+++ src/ngircd/ngircd.c
#include "portab.h"
-static char UNUSED id[] = "$Id: ngircd.c,v 1.68 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: ngircd.c,v 1.69 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
Conn_ExitListeners( );
/* Alten Server-Namen merken */
+ assert( sizeof( old_name ) == sizeof( Conf_ServerName ));
strcpy( old_name, Conf_ServerName );
/* Konfiguration neu lesen ... */
blob - 3be66a9e8859a9a69cdd541f86ffce626c88b1dc
blob + 372aeb0a31c22e2e12ac917020bcb3382664baf4
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
#include "portab.h"
-static char UNUSED id[] = "$Id: parse.c,v 1.53 2002/12/26 16:48:14 alex Exp $";
+static char UNUSED id[] = "$Id: parse.c,v 1.54 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
}
/* Statuscode weiterleiten */
- strcpy( str, Req->command );
+ strlcpy( str, Req->command, sizeof( str ));
for( i = 0; i < Req->argc; i++ )
{
if( i < Req->argc - 1 ) strlcat( str, " ", sizeof( str ));
blob - 367692d6c48cfdb085e379ace4d049c79863ccc9
blob + c833609afdc99fad0e981dac4d4e130d0576ae8c
--- src/ngircd/resolve.c
+++ src/ngircd/resolve.c
#include "portab.h"
-static char UNUSED id[] = "$Id: resolve.c,v 1.4 2002/12/12 12:24:18 alex Exp $";
+static char UNUSED id[] = "$Id: resolve.c,v 1.5 2002/12/26 17:04:54 alex Exp $";
#include "imp.h"
#include <assert.h>
/* Namen aufloesen */
h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
- if( h ) strcpy( hostname, h->h_name );
+ if( h ) strlcpy( hostname, h->h_name, sizeof( hostname ));
else
{
#ifdef h_errno
#else
Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr ));
#endif
- strcpy( hostname, inet_ntoa( Addr->sin_addr ));
+ strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname ));
}
/* Antwort an Parent schreiben */
if( h )
{
addr = (struct in_addr *)h->h_addr;
- strcpy( ip, inet_ntoa( *addr ));
+ strlcpy( ip, inet_ntoa( *addr ), sizeof( ip ));
}
else
{