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:
committed by
Alexandre Deckner
parent
3aa3e03460
commit
560610f70e
@@ -320,10 +320,10 @@ URLInputGroup::URLTextView::InsertText(const char* inText, int32 inLength,
|
|||||||
char* buffer = NULL;
|
char* buffer = NULL;
|
||||||
|
|
||||||
if (strpbrk(inText, "\r\n") && inLength <= 1024) {
|
if (strpbrk(inText, "\r\n") && inLength <= 1024) {
|
||||||
buffer = (char*)malloc(inLength);
|
buffer = (char*)malloc(inLength + 1);
|
||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
strcpy(buffer, inText);
|
strlcpy(buffer, inText, inLength);
|
||||||
|
|
||||||
for (int32 i = 0; i < inLength; i++) {
|
for (int32 i = 0; i < inLength; i++) {
|
||||||
if (buffer[i] == '\r' || buffer[i] == '\n')
|
if (buffer[i] == '\r' || buffer[i] == '\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user