Merge remote-tracking branch 'public/bug7484'

Conflicts:
	src/test/test_addr.c
This commit is contained in:
Nick Mathewson 2014-11-12 13:44:57 -05:00
commit 9b11dc3617
3 changed files with 10 additions and 2 deletions

4
changes/bug7484 Normal file
View File

@ -0,0 +1,4 @@
o Minor bugfixes:
- Stop allowing invalid address patterns containing both a wildcard
address and a bit prefix length. This affects all our
address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14.

View File

@ -723,6 +723,11 @@ tor_addr_parse_mask_ports(const char *s,
/* XXXX_IP6 is this really what we want? */
bits = 96 + bits%32; /* map v4-mapped masks onto 96-128 bits */
}
if (any_flag) {
log_warn(LD_GENERAL,
"Found bit prefix with wildcard address; rejecting");
goto err;
}
} else { /* pick an appropriate mask, as none was given */
if (any_flag)
bits = 0; /* This is okay whether it's V6 or V4 (FIX V4-mapped V6!) */

View File

@ -654,7 +654,7 @@ test_addr_ip6_helpers(void *arg)
tt_int_op(r, OP_EQ, -1);
r=tor_addr_parse_mask_ports("*6",0,&t1, &mask, NULL, NULL);
tt_int_op(r, OP_EQ, -1);
#if 0
tt_assert(r == -1);
/* Try a mask with a wildcard. */
r=tor_addr_parse_mask_ports("*/16",0,&t1, &mask, NULL, NULL);
tt_assert(r == -1);
@ -664,7 +664,6 @@ test_addr_ip6_helpers(void *arg)
r=tor_addr_parse_mask_ports("*6/30",TAPMP_EXTENDED_STAR,
&t1, &mask, NULL, NULL);
tt_assert(r == -1);
#endif
/* Basic mask tests*/
r=tor_addr_parse_mask_ports("1.1.2.2/31",0,&t1, &mask, NULL, NULL);
tt_assert(r == AF_INET);