summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2020-04-08 19:54:47 +0300
committerrl1987 <rl1987@users.noreply.github.com>2020-05-21 13:43:41 +0300
commit38cbfda119558877aeb4fa81578f0d0f6962d03e (patch)
tree173ae6c15f6c79420873afbd209d3feab3faf796
parent17c4e489e95e808a74696d6e46d50dc136d46f10 (diff)
downloadtor-38cbfda119558877aeb4fa81578f0d0f6962d03e.tar.gz
tor-38cbfda119558877aeb4fa81578f0d0f6962d03e.zip
Actually, bail out of routerstatus_format_entry() if fmt_addr32() fails
-rw-r--r--src/feature/nodelist/fmt_routerstatus.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/feature/nodelist/fmt_routerstatus.c b/src/feature/nodelist/fmt_routerstatus.c
index 6cecbf4df8..ca4a312639 100644
--- a/src/feature/nodelist/fmt_routerstatus.c
+++ b/src/feature/nodelist/fmt_routerstatus.c
@@ -54,22 +54,23 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
smartlist_t *chunks = smartlist_new();
const char *ip_str = fmt_addr32(rs->addr);
+ if (ip_str[0] == '\0')
+ goto err;
format_iso_time(published, rs->published_on);
digest_to_base64(identity64, rs->identity_digest);
digest_to_base64(digest64, rs->descriptor_digest);
- if (ip_str[0])
- smartlist_add_asprintf(chunks,
- "r %s %s %s%s%s %s %d %d\n",
- rs->nickname,
- identity64,
- (format==NS_V3_CONSENSUS_MICRODESC)?"":digest64,
- (format==NS_V3_CONSENSUS_MICRODESC)?"":" ",
- published,
- ip_str,
- (int)rs->or_port,
- (int)rs->dir_port);
+ smartlist_add_asprintf(chunks,
+ "r %s %s %s%s%s %s %d %d\n",
+ rs->nickname,
+ identity64,
+ (format==NS_V3_CONSENSUS_MICRODESC)?"":digest64,
+ (format==NS_V3_CONSENSUS_MICRODESC)?"":" ",
+ published,
+ ip_str,
+ (int)rs->or_port,
+ (int)rs->dir_port);
/* TODO: Maybe we want to pass in what we need to build the rest of
* this here, instead of in the caller. Then we could use the