diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-30 15:15:10 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-30 15:15:10 -0400 |
commit | 3c0d944b076aa552216ca598a6cdc50e77ad1a58 (patch) | |
tree | c004763cbfb669a6ef2d80c855e2ea930926a1ee /src/or/router.h | |
parent | b6eee716a88cba0d0ae4be4e542f61b2d300ecec (diff) | |
download | tor-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.h | 7 |
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, |