Don't overwrite memory when pressing return in the URL text input.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@405 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-04-11 23:21:45 +00:00 committed by Alexandre Deckner
parent 3aa3e03460
commit 560610f70e

View File

@ -320,10 +320,10 @@ URLInputGroup::URLTextView::InsertText(const char* inText, int32 inLength,
char* buffer = NULL;
if (strpbrk(inText, "\r\n") && inLength <= 1024) {
buffer = (char*)malloc(inLength);
buffer = (char*)malloc(inLength + 1);
if (buffer) {
strcpy(buffer, inText);
strlcpy(buffer, inText, inLength);
for (int32 i = 0; i < inLength; i++) {
if (buffer[i] == '\r' || buffer[i] == '\n')