From 3dbca8f3381ca27122ea3240dd7fc5499310f0be Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 15 Jul 2026 12:17:57 +0200 Subject: [PATCH] Fix crash `StringUtils::Copy` on Win32 when length is zero --- Source/Engine/Platform/Win32/Win32StringUtils.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Platform/Win32/Win32StringUtils.cpp b/Source/Engine/Platform/Win32/Win32StringUtils.cpp index fb7759cd2..352e214e0 100644 --- a/Source/Engine/Platform/Win32/Win32StringUtils.cpp +++ b/Source/Engine/Platform/Win32/Win32StringUtils.cpp @@ -164,8 +164,15 @@ Char* StringUtils::Copy(Char* dst, const Char* src) Char* StringUtils::Copy(Char* dst, const Char* src, int32 count) { - wcsncpy(dst, src, count - 1); - dst[count - 1] = 0; + if (count != 0) + { + wcsncpy(dst, src, count - 1); + dst[count - 1] = 0; + } + else + { + dst[0] = 0; + } return dst; }