Skip to content

Commit 46d39d5

Browse files
committed
Fixed GCC false positive. (#9508)
1 parent 551a0a6 commit 46d39d5

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

imgui_widgets.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,6 +3635,7 @@ const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, size_t buf_
36353635
const char* fmt_end = ImParseFormatFindEnd(fmt_start);
36363636
if (fmt_end[0] == 0) // If we only have leading decoration, we don't need to copy the data.
36373637
return fmt_start;
3638+
buf[0] = 0; // Fix false positive with caller assuming that buf could be non-initialized (#9508)
36383639
ImStrncpy(buf, fmt_start, ImMin((size_t)(fmt_end - fmt_start) + 1, buf_size));
36393640
return buf;
36403641
}

0 commit comments

Comments
 (0)