[util] Fix strlcpy compiler warning

This commit is contained in:
Philip Rebohle 2022-08-21 01:50:41 +02:00 committed by Joshie
parent f80347d9a9
commit 1c35fbb33c
1 changed files with 3 additions and 2 deletions

View File

@ -205,9 +205,10 @@ namespace dxvk::str {
}
inline void strlcpy(char* dst, const char* src, size_t count) {
std::strncpy(dst, src, count);
if (count > 0)
if (count > 0) {
std::strncpy(dst, src, count - 1);
dst[count - 1] = '\0';
}
}
}