[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Limit version numbers to 0...INT32_MAX.
commit cb6b3b7cadb641b648577e5d5536735222cc68da
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Feb 15 07:57:34 2017 -0500
Limit version numbers to 0...INT32_MAX.
Closes 21450; patch from teor.
---
changes/bug21450 | 4 ++++
src/or/routerparse.c | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/changes/bug21450 b/changes/bug21450
new file mode 100644
index 0000000..a1cf89a
--- /dev/null
+++ b/changes/bug21450
@@ -0,0 +1,4 @@
+ o Minor bugfixes (voting consistency):
+ - Reject version numbers with components that exceed INT32_MAX.
+ Otherwise 32-bit and 64-bit platforms would behave inconsistently.
+ Fixes bug 21450; bugfix on 0.0.8pre1.
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index a896dde..c325412 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -5605,6 +5605,7 @@ tor_version_parse(const char *s, tor_version_t *out)
{
char *eos=NULL;
const char *cp=NULL;
+ int ok = 1;
/* Format is:
* "Tor " ? NUM dot NUM [ dot NUM [ ( pre | rc | dot ) NUM ] ] [ - tag ]
*/
@@ -5620,7 +5621,9 @@ tor_version_parse(const char *s, tor_version_t *out)
#define NUMBER(m) \
do { \
- out->m = (int)strtol(cp, &eos, 10); \
+ out->m = (int)tor_parse_uint64(val, 10, 0, INT32_MAX, &ok, &eos); \
+ if (!ok) \
+ return -1; \
if (!eos || eos == cp) \
return -1; \
cp = eos; \
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits