mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Merge remote-tracking branch 'yawning/bug14922'
This commit is contained in:
commit
0dde4d6fa2
@ -771,16 +771,6 @@ fast_memcmpstart(const void *mem, size_t memlen,
|
||||
return fast_memcmp(mem, prefix, plen);
|
||||
}
|
||||
|
||||
/** Given a nul-terminated string s, set every character before the nul
|
||||
* to zero. */
|
||||
void
|
||||
tor_strclear(char *s)
|
||||
{
|
||||
while (*s) {
|
||||
*s++ = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/** Return a pointer to the first char of s that is not whitespace and
|
||||
* not a comment, or to the terminating NUL if no such character exists.
|
||||
*/
|
||||
|
@ -209,7 +209,6 @@ int strcasecmpstart(const char *s1, const char *s2) ATTR_NONNULL((1,2));
|
||||
int strcmpend(const char *s1, const char *s2) ATTR_NONNULL((1,2));
|
||||
int strcasecmpend(const char *s1, const char *s2) ATTR_NONNULL((1,2));
|
||||
int fast_memcmpstart(const void *mem, size_t memlen, const char *prefix);
|
||||
void tor_strclear(char *s);
|
||||
|
||||
void tor_strstrip(char *s, const char *strip) ATTR_NONNULL((1,2));
|
||||
long tor_parse_long(const char *s, int base, long min,
|
||||
|
@ -173,7 +173,7 @@ rend_authorized_client_free(rend_authorized_client_t *client)
|
||||
return;
|
||||
if (client->client_key)
|
||||
crypto_pk_free(client->client_key);
|
||||
tor_strclear(client->client_name);
|
||||
memwipe(client->client_name, 0, strlen(client->client_name));
|
||||
tor_free(client->client_name);
|
||||
memwipe(client->descriptor_cookie, 0, sizeof(client->descriptor_cookie));
|
||||
tor_free(client);
|
||||
@ -1052,7 +1052,7 @@ rend_service_load_auth_keys(rend_service_t *s, const char *hfname)
|
||||
abort_writing_to_file(open_hfile);
|
||||
done:
|
||||
if (client_keys_str) {
|
||||
tor_strclear(client_keys_str);
|
||||
memwipe(client_keys_str, 0, strlen(client_keys_str));
|
||||
tor_free(client_keys_str);
|
||||
}
|
||||
strmap_free(parsed_clients, rend_authorized_client_strmap_item_free);
|
||||
|
@ -4111,26 +4111,6 @@ test_util_laplace(void *arg)
|
||||
;
|
||||
}
|
||||
|
||||
static void
|
||||
test_util_strclear(void *arg)
|
||||
{
|
||||
static const char *vals[] = { "", "a", "abcdef", "abcdefgh", NULL };
|
||||
int i;
|
||||
char *v = NULL;
|
||||
(void)arg;
|
||||
|
||||
for (i = 0; vals[i]; ++i) {
|
||||
size_t n;
|
||||
v = tor_strdup(vals[i]);
|
||||
n = strlen(v);
|
||||
tor_strclear(v);
|
||||
tt_assert(tor_mem_is_zero(v, n+1));
|
||||
tor_free(v);
|
||||
}
|
||||
done:
|
||||
tor_free(v);
|
||||
}
|
||||
|
||||
#define UTIL_LEGACY(name) \
|
||||
{ #name, test_util_ ## name , 0, NULL, NULL }
|
||||
|
||||
@ -4348,7 +4328,6 @@ struct testcase_t util_tests[] = {
|
||||
UTIL_LEGACY(di_ops),
|
||||
UTIL_TEST(round_to_next_multiple_of, 0),
|
||||
UTIL_TEST(laplace, 0),
|
||||
UTIL_TEST(strclear, 0),
|
||||
UTIL_TEST(find_str_at_start_of_line, 0),
|
||||
UTIL_TEST(string_is_C_identifier, 0),
|
||||
UTIL_TEST(asprintf, 0),
|
||||
|
Loading…
Reference in New Issue
Block a user