[hal] Replace strncpy with memcpy (#3539)

This commit is contained in:
Ryan Hirasaki
2021-09-05 20:47:40 -07:00
committed by GitHub
parent e109c42515
commit 01ba56a8a6

View File

@@ -302,7 +302,7 @@ char* HAL_GetJoystickName(int32_t joystickNum) {
} else {
size_t len = std::strlen(joystickDesc.name);
char* name = static_cast<char*>(std::malloc(len + 1));
std::strncpy(name, joystickDesc.name, len);
std::memcpy(name, joystickDesc.name, len);
name[len] = '\0';
return name;
}