Fixed GCC false positive. (#9508)

This commit is contained in:
ocornut
2026-08-07 18:42:39 +02:00
parent 551a0a6bc0
commit 46d39d56fe

View File

@@ -3635,6 +3635,7 @@ const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, size_t buf_
const char* fmt_end = ImParseFormatFindEnd(fmt_start);
if (fmt_end[0] == 0) // If we only have leading decoration, we don't need to copy the data.
return fmt_start;
buf[0] = 0; // Fix false positive with caller assuming that buf could be non-initialized (#9508)
ImStrncpy(buf, fmt_start, ImMin((size_t)(fmt_end - fmt_start) + 1, buf_size));
return buf;
}