Re-add src == dst check in SafeStringCopyTruncate

Accidentally dropped this while iterating on the exact implementation.
This commit is contained in:
PJB3005
2026-03-27 17:17:45 +01:00
parent a2b32c27c0
commit 5d24e1125f
+4
View File
@@ -26,6 +26,10 @@ template <size_t BufSize>
void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) {
static_assert(BufSize > 0, "Target buffer cannot be size zero");
if (buffer == src) {
CRASH("Cannot copy string to same buffer");
}
strncpyProxy(buffer, src, BufSize);
buffer[BufSize - 1] = 0;
}