Skip to content

Commit 571f797

Browse files
committed
Fix issue with InputText(Multiline) manual overloads which could overflow their native buffers.
1 parent 78b6fd6 commit 571f797

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ImGui.NET/ImGui.Manual.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static bool InputText(
128128
}
129129
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
130130
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
131-
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount + 1, 0, clearBytesCount);
131+
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
132132
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
133133

134134
byte result = ImGuiNative.igInputText(
@@ -218,7 +218,7 @@ public static bool InputTextMultiline(
218218
}
219219
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
220220
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
221-
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount + 1, 0, clearBytesCount);
221+
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
222222
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
223223

224224
byte result = ImGuiNative.igInputTextMultiline(

0 commit comments

Comments
 (0)