]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/lists.c
Fixed some warnings of non-gcc-compilers (e. g. original Apple compiler on
[ngircd-alex.git] / src / ngircd / lists.c
index e3020634e36e2c90afc529dfa3a0fa33b7aae9db..a9d476753aeac68fb07e7ebbe62567271efa00cd 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: lists.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
+static char UNUSED id[] = "$Id: lists.c,v 1.13 2004/03/11 22:16:31 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -30,6 +30,7 @@ static char UNUSED id[] = "$Id: lists.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
 
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 
 #include "exp.h"
 #include "lists.h"
@@ -331,19 +332,17 @@ Lists_MakeMask( CHAR *Pattern )
 
        if(( ! at ) && ( ! excl ))
        {
-               /* weder ! noch @ĂŠvorhanden: als Nick annehmen */
-               strncpy( TheMask, Pattern, MASK_LEN - 5 );
-               TheMask[MASK_LEN - 5] = '\0';
-               strcat( TheMask, "!*@*" );
+               /* weder ! noch @ vorhanden: als Nick annehmen */
+               strlcpy( TheMask, Pattern, sizeof( TheMask ) - 5 );
+               strlcat( TheMask, "!*@*", sizeof( TheMask ));
                return TheMask;
        }
 
        if(( ! at ) && ( excl ))
        {
                /* Domain fehlt */
-               strncpy( TheMask, Pattern, MASK_LEN - 3 );
-               TheMask[MASK_LEN - 3] = '\0';
-               strcat( TheMask, "@*" );
+               strlcpy( TheMask, Pattern, sizeof( TheMask ) - 3 );
+               strlcat( TheMask, "@*", sizeof( TheMask ));
                return TheMask;
        }
 
@@ -351,17 +350,14 @@ Lists_MakeMask( CHAR *Pattern )
        {
                /* User fehlt */
                *at = '\0'; at++;
-               strncpy( TheMask, Pattern, MASK_LEN - 4 );
-               TheMask[MASK_LEN - 4] = '\0';
-               strcat( TheMask, "!*@" );
-               strncat( TheMask, at, strlen( TheMask ) - MASK_LEN - 1 );
-               TheMask[MASK_LEN - 1] = '\0';
+               strlcpy( TheMask, Pattern, sizeof( TheMask ) - strlen( at ) - 4 );
+               strlcat( TheMask, "!*@", sizeof( TheMask ));
+               strlcat( TheMask, at, sizeof( TheMask ));
                return TheMask;
        }
 
        /* alle Teile vorhanden */
-       strncpy( TheMask, Pattern, MASK_LEN - 1 );
-       TheMask[MASK_LEN - 1] = '\0';
+       strlcpy( TheMask, Pattern, sizeof( TheMask ));
        return TheMask;
 } /* Lists_MakeMask */
 
@@ -375,14 +371,14 @@ New_C2C( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
        assert( Chan != NULL );
 
        /* Speicher fuer Eintrag anfordern */
-       c2c = malloc( sizeof( C2C ));
+       c2c = (C2C *)malloc( sizeof( C2C ));
        if( ! c2c )
        {
                Log( LOG_EMERG, "Can't allocate memory! [New_C2C]" );
                return NULL;
        }
 
-       strncpy( c2c->mask, Mask, MASK_LEN );
+       strlcpy( c2c->mask, Mask, sizeof( c2c->mask ));
        c2c->channel = Chan;
        c2c->onlyonce = OnlyOnce;