aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/FunctionGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-15 08:20:37 +0800
committer_ov4 <ov4@ov4.org>2026-10-15 08:20:37 +0800
commitab86ae0284469a9a941f5b196f9cc99a90305e3a (patch)
tree2e22e00e6b2c9465be964a58e10dd71f9aa457b4 /lib/CodeGen/FunctionGen.cc
parentbb64298ef26c9b42ae1bb50fb92b15e509b48c07 (diff)
fix(codegen): prevent NUM_TO_STR buffer overflow
Size REAL buffers for the full fixed-point double range and bound writes with snprintf. Register MinGW CRT aliases for embedded execution. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
-rw-r--r--lib/CodeGen/FunctionGen.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc
index 978970a..ca8fa45 100644
--- a/lib/CodeGen/FunctionGen.cc
+++ b/lib/CodeGen/FunctionGen.cc
@@ -11,7 +11,7 @@ using namespace cps;
static bool isReservedRuntimeName(const std::string &Name) {
static const char *Reserved[] = {
"main", "printf", "scanf", "malloc", "free", "strlen", "memcpy",
- "strcpy", "strcat", "toupper", "tolower", "sprintf", "strtol", "strtoll",
+ "strcpy", "strcat", "toupper", "tolower", "sprintf", "snprintf", "strtol", "strtoll",
"strtod", "memset", "exit",
"fopen", "fclose", "fgetc", "ungetc", "fputs", "fputc",
"realloc", "strcmp", "__cxa_allocate_exception", "__cxa_throw",