/W4: Fix potentially non zero-terminated string

The prior call to 'strcpy' might not zero-terminated string, explicitly perform this operation to prevent this bug.
This commit is contained in:
Kawe Mazidjatari 2023-04-02 16:56:54 +02:00
parent e1f0e72af4
commit a71839f13a

View File

@ -611,6 +611,7 @@ V_MakeAbsolutePath(char* pOut, size_t outLen, const char* pPath, const char* pSt
{
// pPath is not relative.. just copy it.
V_strncpy(pOut, pPath, outLen);
pOut[outLen - 1] = '\0';
}
else
{
@ -618,6 +619,7 @@ V_MakeAbsolutePath(char* pOut, size_t outLen, const char* pPath, const char* pSt
if (pStartingDir && V_IsAbsolutePath(pStartingDir))
{
V_strncpy(pOut, pStartingDir, outLen);
pOut[outLen - 1] = '\0';
}
else
{