Use the right functions; strncpy is usually not the answer

This commit is contained in:
Nick Mathewson 2014-02-07 12:25:49 -05:00
parent f1682a615f
commit aa3c8c1397
1 changed files with 2 additions and 2 deletions

View File

@ -47,9 +47,9 @@ test_nodelist_node_get_verbose_nickname_not_named(void *arg)
memset(&mock_rs, 0, sizeof(routerstatus_t));
/* verbose nickname should use ~ instead of = for unnamed routers */
strncpy(mock_rs.nickname, "TestOR", 6);
strlcpy(mock_rs.nickname, "TestOR", sizeof(mock_rs.nickname));
mock_node.rs = &mock_rs;
strncpy(mock_node.identity,
memcpy(mock_node.identity,
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA",
DIGEST_LEN);