From a815b0af2021733f30c392b4545507a815fdca74 Mon Sep 17 00:00:00 2001 From: Maximilian Mittelhammer Date: Sat, 7 Jan 2023 11:25:27 +0100 Subject: [PATCH] Changed sprintf to snprintf --- src/runtime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime.cpp b/src/runtime.cpp index 3968adb..4ca70dc 100644 --- a/src/runtime.cpp +++ b/src/runtime.cpp @@ -496,7 +496,7 @@ static std::string json_escape(std::string const& in) // escape and print as unicode codepoint constexpr int printed_unicode_length = 6; // 4 hex + letter 'u' + \0 std::array buf; - sprintf(buf.data(), "u%04x", ch); + snprintf(buf.data(), buf.size(), "u%04x", ch); out.append(buf.data(), buf.size() - 1); // add only five, discarding the null terminator. break; }