Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alex Xu
Tor
Commits
bf2ffd39
Commit
bf2ffd39
authored
Sep 21, 2018
by
Nick Mathewson
🌻
Browse files
Merge branch 'maint-0.3.2' into release-0.3.2
parents
04b5b870
5b04392c
Changes
3
Hide whitespace changes
Inline
Side-by-side
changes/bug27316
0 → 100644
View file @
bf2ffd39
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.
src/or/protover.c
View file @
bf2ffd39
...
...
@@ -23,6 +23,7 @@
#define PROTOVER_PRIVATE
#include
"compat.h"
#include
"or.h"
#include
"protover.h"
#include
"routerparse.h"
...
...
@@ -170,6 +171,16 @@ parse_version_range(const char *s, const char *end_of_range,
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
* <b>end_of_entry</b> pointer, and return that protocol entry. Return NULL
* on error.
...
...
@@ -195,6 +206,10 @@ parse_single_entry(const char *s, const char *end_of_entry)
if
(
equals
==
s
)
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
);
tor_assert
(
equals
<
end_of_entry
);
...
...
src/test/test_protover.c
View file @
bf2ffd39
...
...
@@ -283,6 +283,10 @@ test_protover_vote_roundtrip(void *args)
const
char
*
input
;
const
char
*
expected_output
;
}
examples
[]
=
{
{
"Risqu\u00e9=1"
,
NULL
},
{
",,,=1"
,
NULL
},
{
"
\xc1
=1"
,
NULL
},
{
"Foo_Bar=1"
,
NULL
},
{
"Fkrkljdsf"
,
NULL
},
{
"Zn=4294967295"
,
NULL
},
{
"Zn=4294967295-1"
,
NULL
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment