]> jfr.im git - solanum.git/blobdiff - ircd/match.c
ircd startup: avoid black magic with file descriptors
[solanum.git] / ircd / match.c
index 87a1c7eff5000af9fb2cb75b9eab5050a712d914..165baeabc083c59d90b0033e7127bf8b76d2591f 100644 (file)
@@ -308,13 +308,13 @@ match_esc(const char *mask, const char *name)
        return 0;
 }
 
-int comp_with_mask(void *addr, void *dest, u_int mask)
+int comp_with_mask(void *addr, void *dest, unsigned int mask)
 {
        if (memcmp(addr, dest, mask / 8) == 0)
        {
                int n = mask / 8;
                int m = ((-1) << (8 - (mask % 8)));
-               if (mask % 8 == 0 || (((u_char *) addr)[n] & m) == (((u_char *) dest)[n] & m))
+               if (mask % 8 == 0 || (((unsigned char *) addr)[n] & m) == (((unsigned char *) dest)[n] & m))
                {
                        return (1);
                }
@@ -322,7 +322,7 @@ int comp_with_mask(void *addr, void *dest, u_int mask)
        return (0);
 }
 
-int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask)
+int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, unsigned int mask)
 {
        void *iaddr = NULL;
        void *idest = NULL;
@@ -358,8 +358,8 @@ int match_ips(const char *s1, const char *s2)
        void *ipptr, *maskptr;
        int cidrlen, aftype;
 
-       strcpy(mask, s1);
-       strcpy(address, s2);
+       rb_strlcpy(mask, s1, sizeof(mask));
+       rb_strlcpy(address, s2, sizeof(address));
 
        len = strrchr(mask, '/');
        if (len == NULL)
@@ -422,8 +422,8 @@ int match_cidr(const char *s1, const char *s2)
        void *ipptr, *maskptr;
        int cidrlen, aftype;
 
-       strcpy(mask, s1);
-       strcpy(address, s2);
+       rb_strlcpy(mask, s1, sizeof(mask));
+       rb_strlcpy(address, s2, sizeof(address));
 
        ipmask = strrchr(mask, '@');
        if (ipmask == NULL)