From 978766f2e41b75c7c53bfaadd9709305ca28eeb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 20 Nov 2018 09:51:05 +0100 Subject: [PATCH] [code] Use strlcpy instead of memcpy to avoid invalid read --- apps/code/script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/code/script.cpp b/apps/code/script.cpp index ac3651131..f0d8072bc 100644 --- a/apps/code/script.cpp +++ b/apps/code/script.cpp @@ -22,7 +22,7 @@ bool Script::DefaultName(char buffer[], size_t bufferSize) { assert(bufferSize >= k_defaultScriptNameMaxSize); static constexpr char defaultScriptName[] = "script"; static constexpr int defaultScriptNameLength = 6; - memcpy(buffer, defaultScriptName, bufferSize); + strlcpy(buffer, defaultScriptName, bufferSize); int currentScriptNumber = 1; while (currentScriptNumber <= k_maxNumberOfDefaultScriptNames) {