mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Check that fmt_addr32() returned non-empty string before putting it into documents
This commit is contained in:
parent
d8e24684b6
commit
8ab7e30484
@ -322,6 +322,9 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
|
||||
tor_free(digest_algo_b64_digest_bw_file);
|
||||
}
|
||||
|
||||
const char *ip_str = fmt_addr32(addr);
|
||||
|
||||
if (ip_str[0]) {
|
||||
smartlist_add_asprintf(chunks,
|
||||
"network-status-version 3\n"
|
||||
"vote-status %s\n"
|
||||
@ -355,10 +358,11 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
|
||||
bw_headers_line ? bw_headers_line : "",
|
||||
bw_file_digest ? bw_file_digest: "",
|
||||
voter->nickname, fingerprint, voter->address,
|
||||
fmt_addr32(addr), voter->dir_port, voter->or_port,
|
||||
ip_str, voter->dir_port, voter->or_port,
|
||||
voter->contact,
|
||||
shared_random_vote_str ?
|
||||
shared_random_vote_str : "");
|
||||
}
|
||||
|
||||
tor_free(params);
|
||||
tor_free(flags);
|
||||
|
@ -53,10 +53,13 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
|
||||
char digest64[BASE64_DIGEST_LEN+1];
|
||||
smartlist_t *chunks = smartlist_new();
|
||||
|
||||
const char *ip_str = fmt_addr32(rs->addr);
|
||||
|
||||
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,
|
||||
@ -64,7 +67,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
|
||||
(format==NS_V3_CONSENSUS_MICRODESC)?"":digest64,
|
||||
(format==NS_V3_CONSENSUS_MICRODESC)?"":" ",
|
||||
published,
|
||||
fmt_addr32(rs->addr),
|
||||
ip_str,
|
||||
(int)rs->or_port,
|
||||
(int)rs->dir_port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user