Move from strlen to strnlen_s.

Change-Id: I1d25a65e020b45b556723de14ef55a6140229dbb
diff --git a/test/hftest/inc/hftest_impl.h b/test/hftest/inc/hftest_impl.h
index d75b402..34c73e6 100644
--- a/test/hftest/inc/hftest_impl.h
+++ b/test/hftest/inc/hftest_impl.h
@@ -272,7 +272,7 @@
 #define HFTEST_SERVICE_SELECT(vm_id, service, send_buffer)                    \
 	do {                                                                  \
 		struct hf_vcpu_run_return run_res;                            \
-		uint32_t msg_length = strlen(service);                        \
+		uint32_t msg_length = strnlen_s(service, 64);                 \
                                                                               \
 		/*                                                            \
 		 * Let the service configure its mailbox and wait for a       \
diff --git a/test/hftest/linux_main.c b/test/hftest/linux_main.c
index 450dc1c..3cb58d1 100644
--- a/test/hftest/linux_main.c
+++ b/test/hftest/linux_main.c
@@ -52,8 +52,8 @@
 			return;
 		}
 
-		memiter_init(&suite_name, argv[2], strlen(argv[2]));
-		memiter_init(&test_name, argv[3], strlen(argv[3]));
+		memiter_init(&suite_name, argv[2], strnlen_s(argv[2], 64));
+		memiter_init(&test_name, argv[3], strnlen_s(argv[3], 64));
 		hftest_run(suite_name, test_name);
 		return;
 	}
diff --git a/test/vmapi/gicv3/timer_secondary.c b/test/vmapi/gicv3/timer_secondary.c
index 3782b51..df73e57 100644
--- a/test/vmapi/gicv3/timer_secondary.c
+++ b/test/vmapi/gicv3/timer_secondary.c
@@ -99,7 +99,7 @@
 			    enum hf_vcpu_run_code expected_code)
 {
 	const char expected_response[] = "Got IRQ 03.";
-	size_t message_length = strlen(message) + 1;
+	size_t message_length = strnlen_s(message, 64) + 1;
 	struct hf_vcpu_run_return run_res;
 
 	/* Let the secondary get started and wait for our message. */
@@ -238,7 +238,7 @@
 TEST(timer_secondary, wfi_very_long)
 {
 	const char message[] = "WFI  9999999";
-	size_t message_length = strlen(message) + 1;
+	size_t message_length = strnlen_s(message, 64) + 1;
 	struct hf_vcpu_run_return run_res;
 
 	/* Let the secondary get started and wait for our message. */
diff --git a/test/vmapi/primary_with_secondaries/mailbox.c b/test/vmapi/primary_with_secondaries/mailbox.c
index ffb28ff..28eda77 100644
--- a/test/vmapi/primary_with_secondaries/mailbox.c
+++ b/test/vmapi/primary_with_secondaries/mailbox.c
@@ -270,7 +270,7 @@
 	EXPECT_EQ(run_res.sleep.ns, HF_SLEEP_INDEFINITE);
 
 	/* Without clearing our mailbox, send message again. */
-	reverse(message, strlen(message));
+	reverse(message, strnlen_s(message, sizeof(message)));
 	memcpy_s(mb.send->payload, SPCI_MSG_PAYLOAD_MAX, message,
 		 sizeof(message));
 	spci_message_init(mb.send, sizeof(message), SERVICE_VM0,