[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Use the right functions; strncpy is usually not the answer
commit aa3c8c1397beff01fca186f176cd9fe1fa528aed
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri Feb 7 12:25:49 2014 -0500
Use the right functions; strncpy is usually not the answer
---
src/test/test_nodelist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c
index cbdc4a7..600e6a8 100644
--- a/src/test/test_nodelist.c
+++ b/src/test/test_nodelist.c
@@ -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);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits