mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix buffer overflow when pasting text (thanks to Im 'corneum)
This commit is contained in:
parent
03a48dd09f
commit
b7d4beccea
|
@ -244,9 +244,9 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
const char *Text = Input()->GetClipboardText();
|
||||
if(Text)
|
||||
{
|
||||
int CharsLeft = StrSize - str_length(pStr);
|
||||
int Offset = str_length(pStr);
|
||||
for(int i = 0; i < str_length(Text) && i <= CharsLeft; i++)
|
||||
int CharsLeft = StrSize - Offset - 1;
|
||||
for(int i = 0; i < str_length(Text) && i < CharsLeft; i++)
|
||||
{
|
||||
if(Text[i] == '\n')
|
||||
pStr[i + Offset] = ' ';
|
||||
|
|
Loading…
Reference in a new issue