commit 573d62748ab2cacfdbba5ea04e855d56708d34e8 Author: Nick Mathewson nickm@torproject.org Date: Fri Aug 29 15:09:27 2014 -0400
Fix some coverity warnings in new routerset tests --- src/test/test_routerset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c index d6bdd1a..9e5b51e 100644 --- a/src/test/test_routerset.c +++ b/src/test/test_routerset.c @@ -443,7 +443,7 @@ NS(test_main)(void *arg) (void)arg;
NS_MOCK(router_parse_addr_policy_item_from_string); - NS(mock_addr_policy) = tor_malloc_zero(sizeof(NS(mock_addr_policy))); + NS(mock_addr_policy) = tor_malloc_zero(sizeof(addr_policy_t));
set = routerset_new(); s = "*"; @@ -1302,6 +1302,7 @@ NS(test_main)(void *arg) const char *nickname = "foo"; (void)arg;
+ memset(&ei, 0, sizeof(ei)); strmap_set_lc(set->names, nickname, (void *)1); strncpy(ei.nickname, nickname, sizeof(ei.nickname) - 1); ei.nickname[sizeof(ei.nickname) - 1] = '\0'; @@ -1330,6 +1331,7 @@ NS(test_main)(void *arg) const char *nickname = "foo"; (void)arg;
+ memset(&ri, 0, sizeof(ri)); strmap_set_lc(set->names, nickname, (void *)1); ri.nickname = (char *)nickname;
@@ -1361,6 +1363,7 @@ NS(test_main)(void *arg) const char *nickname = "foo"; (void)arg;
+ memset(&rs, 0, sizeof(rs)); strmap_set_lc(set->names, nickname, (void *)1); strncpy(rs.nickname, nickname, sizeof(rs.nickname) - 1); rs.nickname[sizeof(rs.nickname) - 1] = '\0';
tor-commits@lists.torproject.org