aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-07-01 11:43:34 -0400
committerNick Mathewson <nickm@torproject.org>2011-07-01 11:43:34 -0400
commiteca982d3eb1e715394b2c67d8f420bcbe4a8486d (patch)
treed697f226d976336e84b12e6f51347981406260f3 /src/or/routerlist.c
parent1d18c2deb6d048a8d6f726e6c1b8ccbab4374e32 (diff)
downloadtor-eca982d3eb1e715394b2c67d8f420bcbe4a8486d.tar.gz
tor-eca982d3eb1e715394b2c67d8f420bcbe4a8486d.zip
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.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f711282b13..15f643cf79 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)