IridiumSBD: use strncpy instead of strcpy

This commit is contained in:
Beat Küng
2017-04-06 11:48:35 +02:00
committed by Lorenz Meier
parent 9be11c048a
commit ecb0dc2bc4
+2 -1
View File
@@ -135,7 +135,8 @@ void IridiumSBD::test(int argc, char *argv[])
} }
if (argc > 2) { if (argc > 2) {
strcpy(instance->test_command, argv[2]); strncpy(instance->test_command, argv[2], sizeof(instance->test_command));
instance->test_command[sizeof(instance->test_command) - 1] = 0;
} else { } else {
instance->test_command[0] = 0; instance->test_command[0] = 0;