X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconf.c;h=779425971439e08492c8f55f2e997dd7ce463ffc;hb=5a132550deb58473285e5f91705d286aef47be71;hp=5dc7017191c6f15d857201c4aaf8ad819741a383;hpb=76165488f8201a59e649b4eec02ee31398b3fb92;p=tinc diff --git a/src/conf.c b/src/conf.c index 5dc70171..77942597 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2,7 +2,7 @@ conf.c -- configuration code Copyright (C) 1998 Robert van der Meulen 1998-2005 Ivo Timmermans - 2000-2006 Guus Sliepen + 2000-2009 Guus Sliepen 2000 Cris van Pelt This program is free software; you can redistribute it and/or modify @@ -218,9 +218,9 @@ bool get_config_subnet(const config_t *cfg, subnet_t ** result) { /* Teach newbies what subnets are... */ if(((subnet.type == SUBNET_IPV4) - && !maskcheck(&subnet.net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t))) + && !maskcheck(&subnet.net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof subnet.net.ipv4.address)) || ((subnet.type == SUBNET_IPV6) - && !maskcheck(&subnet.net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(ipv6_t)))) { + && !maskcheck(&subnet.net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof subnet.net.ipv6.address))) { logger(LOG_ERR, _ ("Network address and prefix length do not match for configuration variable %s in %s line %d"), cfg->variable, cfg->file, cfg->line); return false; @@ -287,6 +287,8 @@ static char *readline(FILE * fp, char **buf, size_t *buflen) { size = newsize; } else { *newline = '\0'; /* kill newline */ + if(newline > p && newline[-1] == '\r') /* and carriage return if necessary */ + newline[-1] = '\0'; break; /* yay */ } }