mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-08 15:35:50 +01:00
Fix string field inputs using INT_MAX capacity
This commit is contained in:
parent
420f179341
commit
e4b876ec60
@ -4925,7 +4925,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
IM_ASSERT(new_len + 1 <= buf_size && "Is your input buffer properly zero-terminated?");
|
||||
state->WantReloadUserBuf = false;
|
||||
InputTextReconcileUndoState(state, state->TextA.Data, state->TextLen, buf, new_len);
|
||||
state->TextA.resize(buf_size + 1); // we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
state->TextA.resize(buf_size < INT_MAX ? buf_size + 1 : buf_size); // we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
state->TextLen = new_len;
|
||||
memcpy(state->TextA.Data, buf, state->TextLen + 1);
|
||||
state->Stb->select_start = state->ReloadSelectionStart;
|
||||
@ -4963,7 +4963,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
state->EditedBefore = false;
|
||||
if (!is_readonly)
|
||||
{
|
||||
state->TextA.resize(buf_size + 1); // we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
state->TextA.resize(buf_size < INT_MAX ? buf_size + 1 : buf_size); // we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
memcpy(state->TextA.Data, buf, state->TextLen + 1);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user