From aacf993ee15c4d168fb5528d8f78f4cb1767dc04 Mon Sep 17 00:00:00 2001 From: Francisco Gallego Date: Wed, 30 Jan 2019 10:19:40 +0100 Subject: [PATCH] ImStrncpy: Fixed -Wstringop-truncation warning on GCC8 (#2323) --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 8d859351b..4fd20a9ed 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1295,7 +1295,8 @@ int ImStrnicmp(const char* str1, const char* str2, size_t count) void ImStrncpy(char* dst, const char* src, size_t count) { if (count < 1) return; - strncpy(dst, src, count); + if (count > 1) + strncpy(dst, src, count-1); dst[count-1] = 0; }