aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/circuituse.c2
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/connection_or.c2
-rw-r--r--src/or/directory.c4
-rw-r--r--src/or/router.c2
-rw-r--r--src/or/routerparse.c2
-rw-r--r--src/or/test.c3
7 files changed, 8 insertions, 9 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 9173bc09a..549993a7c 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -79,7 +79,7 @@ static int circuit_is_acceptable(circuit_t *circ,
/* 0.0.7 servers and earlier don't support DNS resolution. There are no
* ORs running code before 0.0.7, so we only worry about 0.0.7. Once all
* servers are running 0.0.8, remove this check. */
- if (!strncmp(exitrouter->platform, "Tor 0.0.7", 9))
+ if (!strcmpstart(exitrouter->platform, "Tor 0.0.7"))
return 0;
} else if(purpose == CIRCUIT_PURPOSE_C_GENERAL) {
if(!connection_ap_can_use_exit(conn, exitrouter)) {
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d1bf109f2..1b2279c93 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -957,7 +957,7 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit)
/* 0.0.7 servers and earlier don't support DNS resolution. There are no
* ORs running code before 0.0.7, so we only worry about 0.0.7. Once all
* servers are running 0.0.8, remove this check. XXX */
- return strncmp(exit->platform, "Tor 0.0.7", 9) ? 1 : 0;
+ return strcmpstart(exit->platform, "Tor 0.0.7") ? 1 : 0;
}
addr = client_dns_lookup_entry(conn->socks_request->address);
if(router_compare_addr_to_exit_policy(addr,
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 2d18e90e2..5272b4a6c 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -218,7 +218,7 @@ int connection_tls_start_handshake(connection_t *conn, int receiving) {
him = router_get_by_digest(conn->identity_digest);
me = router_get_my_routerinfo();
- if(him && !strncmp(him->platform, "Tor 0.0.7", 9) &&
+ if(him && !strcmpstart(him->platform, "Tor 0.0.7") &&
(!me || !me->is_verified)) {
log_fn(LOG_INFO,"He's running 0.0.7, and I'm unverified. Acting like OP.");
use_no_cert = 1;
diff --git a/src/or/directory.c b/src/or/directory.c
index 872f7b7cd..e738796e9 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -623,7 +623,7 @@ directory_handle_command_get(connection_t *conn, char *headers,
return 0;
}
- if(!strncmp(url,rend_fetch_url,strlen(rend_fetch_url))) {
+ if(!strcmpstart(url,rend_fetch_url)) {
/* rendezvous descriptor fetch */
const char *descp;
int desc_len;
@@ -709,7 +709,7 @@ directory_handle_command_post(connection_t *conn, char *headers,
return 0;
}
- if(!strncmp(url,rend_publish_string,strlen(rend_publish_string))) {
+ if(!strcmpstart(url,rend_publish_string)) {
/* rendezvous descriptor post */
if(rend_cache_store(body, body_len) < 0)
connection_write_to_buf(answer400, strlen(answer400), conn);
diff --git a/src/or/router.c b/src/or/router.c
index 8eb483643..ce564ff97 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -397,7 +397,7 @@ void router_retry_connections(void) {
int router_is_clique_mode(routerinfo_t *router) {
if(router->is_trusted_dir)
return 1;
- if(!strncmp(router->platform, "Tor 0.0.7", 9))
+ if(!strcmpstart(router->platform, "Tor 0.0.7"))
return 1;
return 0;
}
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index c970851b9..fdc34f205 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -591,7 +591,7 @@ router_parse_list_from_string(const char **s, routerlist_t **dest,
while (1) {
*s = eat_whitespace(*s);
/* Don't start parsing the rest of *s unless it contains a router. */
- if (strncmp(*s, "router ", 7)!=0)
+ if (strcmpstart(*s, "router ")!=0)
break;
if ((end = strstr(*s+1, "\nrouter "))) {
end++;
diff --git a/src/or/test.c b/src/or/test.c
index 0ca1ab290..3546cbc2a 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -869,8 +869,7 @@ test_dir_format()
bw_lines = rep_hist_get_bandwidth_lines();
test_assert(bw_lines);
- test_assert(!strncmp(bw_lines, "opt write-history ",
- strlen("opt write-history ")));
+ test_assert(!strcmpstart(bw_lines, "opt write-history "));
test_assert(!crypto_pk_write_public_key_to_string(pk1, &pk1_str,
&pk1_str_len));