Browse Source

Merge remote-tracking branch 'tor-github/pr/313'

Nick Mathewson 5 years ago
parent
commit
328bcbf305

+ 3 - 4
src/feature/hs/hs_client.c

@@ -1524,10 +1524,9 @@ parse_auth_file_content(const char *client_key_str)
   if (seckey_b32) {
     memwipe(seckey_b32, 0, strlen(seckey_b32));
   }
-  if (fields) {
-    SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
-    smartlist_free(fields);
-  }
+  tor_assert(fields);
+  SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
+  smartlist_free(fields);
   return auth;
 }
 

+ 3 - 4
src/feature/hs/hs_service.c

@@ -1192,10 +1192,9 @@ parse_authorized_client(const char *client_key_str)
   if (pubkey_b32) {
     memwipe(pubkey_b32, 0, strlen(pubkey_b32));
   }
-  if (fields) {
-    SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
-    smartlist_free(fields);
-  }
+  tor_assert(fields);
+  SMARTLIST_FOREACH(fields, char *, s, tor_free(s));
+  smartlist_free(fields);
   return client;
 }
 

+ 3 - 3
src/test/hs_test_helpers.c

@@ -241,11 +241,11 @@ hs_helper_desc_equal(const hs_descriptor_t *desc1,
       hs_desc_authorized_client_t
         *client1 = smartlist_get(desc1->superencrypted_data.clients, i),
         *client2 = smartlist_get(desc2->superencrypted_data.clients, i);
-      tor_memeq(client1->client_id, client2->client_id,
+      tt_mem_op(client1->client_id, OP_EQ, client2->client_id,
                 sizeof(client1->client_id));
-      tor_memeq(client1->iv, client2->iv,
+      tt_mem_op(client1->iv, OP_EQ, client2->iv,
                 sizeof(client1->iv));
-      tor_memeq(client1->encrypted_cookie, client2->encrypted_cookie,
+      tt_mem_op(client1->encrypted_cookie, OP_EQ, client2->encrypted_cookie,
                 sizeof(client1->encrypted_cookie));
     }
   }

+ 2 - 0
src/test/test_hs_descriptor.c

@@ -675,6 +675,8 @@ test_decode_bad_signature(void *arg)
 
   (void) arg;
 
+  memset(&desc_plaintext, 0, sizeof(desc_plaintext));
+
   /* Update approx time to dodge cert expiration */
   update_approx_time(1502661599);
 

+ 1 - 3
src/test/test_hs_service.c

@@ -563,9 +563,7 @@ test_load_keys_with_client_auth(void *arg)
   } SMARTLIST_FOREACH_END(pubkey_b32);
 
  done:
-  if (pubkey_b32_list) {
-    SMARTLIST_FOREACH(pubkey_b32_list, char *, s, tor_free(s));
-  }
+  SMARTLIST_FOREACH(pubkey_b32_list, char *, s, tor_free(s));
   smartlist_free(pubkey_b32_list);
   tor_free(hsdir_v3);
   hs_free_all();