Reject Tor versions that contain non-numeric prefixes

strto* and _atoi64 accept +, -, and various whitespace before numeric
characters. And permitted whitespace is different between POSIX and Windows.

Fixes bug 21507 and part of 21508; bugfix on 0.0.8pre1.
This commit is contained in:
teor 2017-02-19 22:38:06 +11:00
parent 67cec7578c
commit 57154e71aa
No known key found for this signature in database
GPG Key ID: 450CBA7F968F094B
2 changed files with 7 additions and 0 deletions

5
changes/bug21507 Normal file
View File

@ -0,0 +1,5 @@
o Minor bugfixes (voting consistency):
- Reject version numbers with non-numeric prefixes (such as +, -, and
whitespace). Disallowing whitespace prevents differential version
parsing between POSIX-based and Windows platforms.
Fixes bug 21507 and part of 21508; bugfix on 0.0.8pre1.

View File

@ -5621,6 +5621,8 @@ tor_version_parse(const char *s, tor_version_t *out)
#define NUMBER(m) \
do { \
if (!cp || *cp < '0' || *cp > '9') \
return -1; \
out->m = (int)tor_parse_uint64(cp, 10, 0, INT32_MAX, &ok, &eos); \
if (!ok) \
return -1; \