]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-server.c
- replaced a lot of strcat() calls with strlcat() which is more secure.
[ngircd-alex.git] / src / ngircd / irc-server.c
index e5846dd4a038af7bc5a654ce7a74e761a4731ab0..6a6f4712febfcfc632a22f27aa111dcf7c289cae 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-server.c,v 1.24 2002/12/12 12:24:18 alex Exp $";
+static char UNUSED id[] = "$Id: irc-server.c,v 1.26 2002/12/26 16:48:14 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -195,10 +195,10 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
                                assert( cl != NULL );
 
                                /* Nick, ggf. mit Modes, anhaengen */
-                               if( str[strlen( str ) - 1] != ':' ) strcat( str, "," );
-                               if( strchr( Channel_UserModes( chan, cl ), 'v' )) strcat( str, "+" );
-                               if( strchr( Channel_UserModes( chan, cl ), 'o' )) strcat( str, "@" );
-                               strcat( str, Client_ID( cl ));
+                               if( str[strlen( str ) - 1] != ':' ) strlcat( str, ",", sizeof( str ));
+                               if( strchr( Channel_UserModes( chan, cl ), 'v' )) strlcat( str, "+", sizeof( str ));
+                               if( strchr( Channel_UserModes( chan, cl ), 'o' )) strlcat( str, "@", sizeof( str ));
+                               strlcat( str, Client_ID( cl ), sizeof( str ));
 
                                if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 8 ))
                                {
@@ -284,8 +284,7 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
        /* Falsche Anzahl Parameter? */
        if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 
-       strncpy( str, Req->argv[1], COMMAND_LEN - 1 );
-       str[COMMAND_LEN - 1] = '\0';
+       strlcpy( str, Req->argv[1], sizeof( str ));
 
        channame = Req->argv[0];
        ptr = strtok( str, "," );