From 560610f70eb60020d17ec3c2889357b18aa4e322 Mon Sep 17 00:00:00 2001 From: stippi Date: Sun, 11 Apr 2010 23:21:45 +0000 Subject: [PATCH] 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 --- src/apps/webpositive/URLInputGroup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/webpositive/URLInputGroup.cpp b/src/apps/webpositive/URLInputGroup.cpp index 32cbffd55b..1f69f60538 100644 --- a/src/apps/webpositive/URLInputGroup.cpp +++ b/src/apps/webpositive/URLInputGroup.cpp @@ -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')