summaryrefslogtreecommitdiff
path: root/src/or/router.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-30 15:15:10 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-30 15:15:10 -0400
commit3c0d944b076aa552216ca598a6cdc50e77ad1a58 (patch)
treec004763cbfb669a6ef2d80c855e2ea930926a1ee /src/or/router.h
parentb6eee716a88cba0d0ae4be4e542f61b2d300ecec (diff)
downloadtor-3c0d944b076aa552216ca598a6cdc50e77ad1a58.tar.gz
tor-3c0d944b076aa552216ca598a6cdc50e77ad1a58.zip
Improve comments and defensive programming for 3045
The comment fixes are trivial. The defensive programming trick is to tolerate receiving NULL inputs on the describe functions. That should never actually happen, but it seems like the likeliest mistake for us to make in the future.
Diffstat (limited to 'src/or/router.h')
-rw-r--r--src/or/router.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/router.h b/src/or/router.h
index 6cabfd56e8..a285a3e773 100644
--- a/src/or/router.h
+++ b/src/or/router.h
@@ -86,6 +86,13 @@ int is_legal_nickname(const char *s);
int is_legal_nickname_or_hexdigest(const char *s);
int is_legal_hexdigest(const char *s);
+/**
+ * Longest allowed output of format_node_description, plus 1 character for
+ * NUL. This allows space for:
+ * "$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at"
+ * " [ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]"
+ * plus a terminating NUL.
+ */
#define NODE_DESC_BUF_LEN (MAX_VERBOSE_NICKNAME_LEN+4+TOR_ADDR_BUF_LEN)
const char *format_node_description(char *buf,
const char *id_digest,