summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-10-14 15:31:52 -0400
committerNick Mathewson <nickm@torproject.org>2018-10-14 15:31:52 -0400
commit2dccef0eb490fa7d8fabc0d93e37d6635910f174 (patch)
tree65138098218cb4b11ffcbd3f6ac90501c45e2e99 /src/feature
parent2c5c17510acf0cbd0eeb874a2f4c62203bf9392f (diff)
parent6925b61cfdf50a5686de02645b04b269c031f05d (diff)
downloadtor-2dccef0eb490fa7d8fabc0d93e37d6635910f174.tar.gz
tor-2dccef0eb490fa7d8fabc0d93e37d6635910f174.zip
Merge branch 'bug27772_squashed'
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/dirparse/policy_parse.c10
-rw-r--r--src/feature/nodelist/torcert.c1
2 files changed, 9 insertions, 2 deletions
diff --git a/src/feature/dirparse/policy_parse.c b/src/feature/dirparse/policy_parse.c
index e102a62282..f9102dd873 100644
--- a/src/feature/dirparse/policy_parse.c
+++ b/src/feature/dirparse/policy_parse.c
@@ -168,7 +168,14 @@ router_parse_addr_policy(directory_token_t *tok, unsigned fmt_flags)
return NULL;
}
- return addr_policy_get_canonical_entry(&newe);
+ addr_policy_t *result = addr_policy_get_canonical_entry(&newe);
+ /* It would be a nasty error to return 'newe', and sometimes
+ * addr_policy_get_canonical_entry() can return its argument. But in this
+ * case, it won't, since newe is *not* canonical. We assert here to make
+ * sure that the compiler knows it too.
+ */
+ tor_assert(result != &newe);
+ return result;
}
/** Parse an exit policy line of the format "accept[6]/reject[6] private:...".
@@ -215,4 +222,3 @@ router_parse_addr_policy_private(directory_token_t *tok)
return addr_policy_get_canonical_entry(&result);
}
-
diff --git a/src/feature/nodelist/torcert.c b/src/feature/nodelist/torcert.c
index 675d5c97b7..9962ed653f 100644
--- a/src/feature/nodelist/torcert.c
+++ b/src/feature/nodelist/torcert.c
@@ -51,6 +51,7 @@ tor_cert_sign_impl(const ed25519_keypair_t *signing_key,
tor_cert_t *torcert = NULL;
ed25519_cert_t *cert = ed25519_cert_new();
+ tor_assert(cert); // Trunnel's new functions can return NULL.
cert->cert_type = cert_type;
cert->exp_field = (uint32_t) CEIL_DIV(now + lifetime, 3600);
cert->cert_key_type = signed_key_type;