aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-13 13:30:53 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-13 13:30:53 -0400
commit787da5185c531c890343c0b95190de9f48246934 (patch)
tree4d671fbbe77d2fe97b38f579d7a8d816b7e69f02
parente8b81d7dc5cb03a97136125d3ea50788fad9eab3 (diff)
parentcb9fa3b04c7d35eb04bb5f695606bfafe97c88d1 (diff)
downloadtor-787da5185c531c890343c0b95190de9f48246934.tar.gz
tor-787da5185c531c890343c0b95190de9f48246934.zip
Merge remote-tracking branch 'onionk/strcmpstart1'
-rw-r--r--changes/ticket276303
-rw-r--r--src/feature/nodelist/networkstatus.c2
-rw-r--r--src/feature/nodelist/routerparse.c3
3 files changed, 5 insertions, 3 deletions
diff --git a/changes/ticket27630 b/changes/ticket27630
new file mode 100644
index 0000000000..8a5f5d6b5b
--- /dev/null
+++ b/changes/ticket27630
@@ -0,0 +1,3 @@
+ o Code simplification and refactoring:
+ - Use the simpler strcmpstart() helper in rend_parse_v2_service_descriptor
+ instead of strncmp(). Closes ticket 27630.
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index 6492b828b1..6e386628d7 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -201,7 +201,7 @@ networkstatus_reset_download_failures(void)
/**
* Read and and return the cached consensus of type <b>flavorname</b>. If
- * <b>unverified</b> is false, get the one we haven't verified. Return NULL if
+ * <b>unverified</b> is true, get the one we haven't verified. Return NULL if
* the file isn't there. */
static char *
networkstatus_read_cached_consensus_impl(int flav,
diff --git a/src/feature/nodelist/routerparse.c b/src/feature/nodelist/routerparse.c
index 73d320de40..b76b2974fa 100644
--- a/src/feature/nodelist/routerparse.c
+++ b/src/feature/nodelist/routerparse.c
@@ -5167,8 +5167,7 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
tor_assert(desc);
/* Check if desc starts correctly. */
- if (strncmp(desc, "rendezvous-service-descriptor ",
- strlen("rendezvous-service-descriptor "))) {
+ if (strcmpstart(desc, "rendezvous-service-descriptor ")) {
log_info(LD_REND, "Descriptor does not start correctly.");
goto err;
}