]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Reject Tor versions that contain non-numeric prefixes
authorteor <teor2345@gmail.com>
Sun, 19 Feb 2017 11:38:06 +0000 (22:38 +1100)
committerteor <teor2345@gmail.com>
Sun, 19 Feb 2017 11:38:06 +0000 (22:38 +1100)
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.

changes/bug21507 [new file with mode: 0644]
src/or/routerparse.c

diff --git a/changes/bug21507 b/changes/bug21507
new file mode 100644 (file)
index 0000000..f83e291
--- /dev/null
@@ -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.
index 2ee0d2720ee09916f6ef153182917b2c7e756479..521e237be2966778114859a7a7b4e5a92f6b1dd4 100644 (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;                                \