From e66bc80c49ab1e94dd90e37ff1c986746b834875 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Mon, 5 Apr 2021 13:25:40 -0400 Subject: [PATCH] Fix -Wstringop-truncation issues --- hecl/lib/hecl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hecl/lib/hecl.cpp b/hecl/lib/hecl.cpp index 20b2cf066..5bf82af00 100644 --- a/hecl/lib/hecl.cpp +++ b/hecl/lib/hecl.cpp @@ -645,7 +645,8 @@ int RecursiveMakeDir(const SystemChar* dir) { SystemChar tmp[1024]; /* copy path */ - std::strncpy(tmp, dir, std::size(tmp)); + std::memset(tmp, 0, std::size(tmp)); + std::strncpy(tmp, dir, std::size(tmp) - 1); const size_t len = std::strlen(tmp); if (len >= std::size(tmp)) { return -1;