aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-10-14 11:28:37 -0400
committerNick Mathewson <nickm@torproject.org>2020-10-14 11:28:37 -0400
commitdd63b972883f6c0b23ee2f7661b7897b229dd28f (patch)
tree58d3a6bedb61dc9fcc8f1c1a99f2a170fa96e4f8 /src/core
parent741edf1b458f56f516a02aa72bfae99371b3ec5a (diff)
downloadtor-dd63b972883f6c0b23ee2f7661b7897b229dd28f.tar.gz
tor-dd63b972883f6c0b23ee2f7661b7897b229dd28f.zip
Implement proposal 318: Limit protovers to 0..63
In brief: we go through a lot of gymnastics to handle huge protover numbers, but after years of development we're not even close to 10 for any of our current versions. We also have a convenient workaround available in case we ever run out of protocols: if (for example) we someday need Link=64, we can just add Link2=0 or something. This patch is a minimal patch to change tor's behavior; it doesn't take advantage of the new restrictions. Implements #40133 and proposal 318.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/protover.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/or/protover.c b/src/core/or/protover.c
index 17979d04ea..dfb0e9e303 100644
--- a/src/core/or/protover.c
+++ b/src/core/or/protover.c
@@ -113,13 +113,13 @@ proto_entry_free_(proto_entry_t *entry)
}
/** The largest possible protocol version. */
-#define MAX_PROTOCOL_VERSION (UINT32_MAX-1)
+#define MAX_PROTOCOL_VERSION (63)
/**
* Given a string <b>s</b> and optional end-of-string pointer
* <b>end_of_range</b>, parse the protocol range and store it in
* <b>low_out</b> and <b>high_out</b>. A protocol range has the format U, or
- * U-U, where U is an unsigned 32-bit integer.
+ * U-U, where U is an unsigned integer between 0 and 63 inclusive.
*/
static int
parse_version_range(const char *s, const char *end_of_range,