]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-server.c
- replaced a lot of strcpy() calls with strlcpy() which is more secure.
[ngircd-alex.git] / src / ngircd / irc-server.c
index 0be6678362c9ecbd475d2b9bafb5a30597d2153b..93ae5ee174bf13ed3b2e6317647f7208a4610087 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-server.c,v 1.25 2002/12/26 16:25:43 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>
@@ -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 ))
                                {
@@ -314,7 +314,7 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
                        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 */