]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
you can't strcasecmp on 20-byte digests
authorRoger Dingledine <arma@torproject.org>
Wed, 11 Jun 2008 22:46:31 +0000 (22:46 +0000)
committerRoger Dingledine <arma@torproject.org>
Wed, 11 Jun 2008 22:46:31 +0000 (22:46 +0000)
what if they contain nuls?
(worse, what if they *don't* contain nuls? ;)

svn:r15149

src/or/rendservice.c

index bf5eb3889ad75ced4b28975b8643f06d284421f3..f5009185e06a155e814f571b40ff50a07370d948 100644 (file)
@@ -1026,8 +1026,8 @@ find_intro_circuit(rend_intro_point_t *intro, const char *pk_digest,
   tor_assert(intro);
   while ((circ = circuit_get_next_by_pk_and_purpose(circ,pk_digest,
                                                   CIRCUIT_PURPOSE_S_INTRO))) {
-    if (!strcasecmp(circ->build_state->chosen_exit->identity_digest,
-                    intro->extend_info->identity_digest) &&
+    if (!memcmp(circ->build_state->chosen_exit->identity_digest,
+                intro->extend_info->identity_digest, DIGEST_LEN) &&
         circ->rend_desc_version == desc_version) {
       return circ;
     }
@@ -1036,8 +1036,8 @@ find_intro_circuit(rend_intro_point_t *intro, const char *pk_digest,
   circ = NULL;
   while ((circ = circuit_get_next_by_pk_and_purpose(circ,pk_digest,
                                         CIRCUIT_PURPOSE_S_ESTABLISH_INTRO))) {
-    if (!strcasecmp(circ->build_state->chosen_exit->identity_digest,
-                    intro->extend_info->identity_digest) &&
+    if (!memcmp(circ->build_state->chosen_exit->identity_digest,
+                intro->extend_info->identity_digest, DIGEST_LEN) &&
         circ->rend_desc_version == desc_version) {
       return circ;
     }