mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Merge branch 'maint-0.3.4'
This commit is contained in:
commit
9b0a17a74f
3
changes/bug27316
Normal file
3
changes/bug27316
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor bugfixes (protover):
|
||||||
|
- Reject protocol names containing bytes other than alphanumeric characters
|
||||||
|
and hyphens ([A-Za-z0-9-]). Fixes bug 27316; bugfix on 0.2.9.4-alpha.
|
@ -179,6 +179,16 @@ parse_version_range(const char *s, const char *end_of_range,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
is_valid_keyword(const char *s, size_t n)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < n; i++) {
|
||||||
|
if (!TOR_ISALNUM(s[i]) && s[i] != '-')
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/** Parse a single protocol entry from <b>s</b> up to an optional
|
/** Parse a single protocol entry from <b>s</b> up to an optional
|
||||||
* <b>end_of_entry</b> pointer, and return that protocol entry. Return NULL
|
* <b>end_of_entry</b> pointer, and return that protocol entry. Return NULL
|
||||||
* on error.
|
* on error.
|
||||||
@ -213,6 +223,11 @@ parse_single_entry(const char *s, const char *end_of_entry)
|
|||||||
MAX_PROTOCOL_NAME_LENGTH, escaped(out->name));
|
MAX_PROTOCOL_NAME_LENGTH, escaped(out->name));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The name must contain only alphanumeric characters and hyphens. */
|
||||||
|
if (!is_valid_keyword(s, equals-s))
|
||||||
|
goto error;
|
||||||
|
|
||||||
out->name = tor_strndup(s, equals-s);
|
out->name = tor_strndup(s, equals-s);
|
||||||
|
|
||||||
tor_assert(equals < end_of_entry);
|
tor_assert(equals < end_of_entry);
|
||||||
|
@ -554,6 +554,10 @@ test_protover_vote_roundtrip(void *args)
|
|||||||
const char *input;
|
const char *input;
|
||||||
const char *expected_output;
|
const char *expected_output;
|
||||||
} examples[] = {
|
} examples[] = {
|
||||||
|
{ "Risqu\u00e9=1", NULL },
|
||||||
|
{ ",,,=1", NULL },
|
||||||
|
{ "\xc1=1", NULL },
|
||||||
|
{ "Foo_Bar=1", NULL },
|
||||||
{ "Fkrkljdsf", NULL },
|
{ "Fkrkljdsf", NULL },
|
||||||
{ "Zn=4294967295", NULL },
|
{ "Zn=4294967295", NULL },
|
||||||
{ "Zn=4294967295-1", NULL },
|
{ "Zn=4294967295-1", NULL },
|
||||||
|
Loading…
Reference in New Issue
Block a user