X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnetutl.c;h=4d91bf4460cb1e40662e0c47c915cf4f804b27ed;hp=20d3809d8974624169439ff3f344de0a6173cb06;hb=d333fca4d611b85dd922ddf35bd9eddcb8095c85;hpb=ad6b1203490699ecc708290b2af1a45e134a5e20 diff --git a/src/netutl.c b/src/netutl.c index 20d3809d..4d91bf44 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.12.4.34 2002/04/05 09:11:38 guus Exp $ + $Id: netutl.c,v 1.12.4.37 2002/06/07 11:14:05 wsl Exp $ */ #include "config.h" @@ -27,6 +27,9 @@ #include #include #include +#ifndef HAVE_NETBSD + #include +#endif #include #include #include @@ -233,14 +236,13 @@ int maskcheck(char *a, int masklen, int len) cp i = masklen / 8; masklen %= 8; - - if(masklen) - if(a[i++] & (char)~(0x100 - (1 << masklen))) - return -1; - + + if(a[i++] & (0xff >> masklen)) + return -1; + for(; i < len; i++) if(a[i] != 0) - return -1; + return -2; return 0; }