commit eca982d3eb1e715394b2c67d8f420bcbe4a8486d Author: Nick Mathewson nickm@torproject.org Date: Fri Jul 1 11:43:34 2011 -0400
Defensive programming: don't crash with broken node_t
Every node_t has either a routerinfo_t or a routerstatus_t, so every node_t *should* have a nickname. Nonetheless, let's make sure in hex_digest_nickname_matches().
Should quiet CID 434. --- src/or/routerlist.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index f711282..15f643c 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2274,6 +2274,8 @@ hex_digest_nickname_matches(const char *hexdigest, const char *identity_digest, return 0;
if (nn_char == '=' || nn_char == '~') { + if (!nickname) + return 0; if (strcasecmp(nn_buf, nickname)) return 0; if (nn_char == '=' && !is_named)