Chore: don't use strncpy in favor of strlcpy

strncpy doesn't require target to be NUL terminated
This commit is contained in:
李通洲
2024-10-17 16:16:04 +08:00
parent 8f79d6ab1d
commit 993902916d
5 changed files with 13 additions and 13 deletions
+1 -2
View File
@@ -460,8 +460,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
{
if (ffStrStartsWith(entry->d_name, "card"))
{
strncpy(drmKeyBuffer, entry->d_name, sizeof(drmKeyBuffer) - 1);
drmKeyBuffer[sizeof(drmKeyBuffer) - 1] = '\0';
strlcpy(drmKeyBuffer, entry->d_name, sizeof(drmKeyBuffer));
drmKey = drmKeyBuffer;
break;
}