Fix issue with InputText(Multiline) manual overloads which could overflow their native buffers.

internals
Eric Mellino 6 years ago
parent 78b6fd6042
commit 571f7975cd
  1. 4
      src/ImGui.NET/ImGui.Manual.cs

@ -128,7 +128,7 @@ namespace ImGuiNET
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount + 1, 0, clearBytesCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputText(
@ -218,7 +218,7 @@ namespace ImGuiNET
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount + 1, 0, clearBytesCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputTextMultiline(

Loading…
Cancel
Save