[haiku-webkit-commits] r405 - webkit/trunk/WebKit/haiku/WebPositive

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sun, 11 Apr 2010 23:21:46 +0000

Author: stippi
Date: Sun Apr 11 23:21:45 2010
New Revision: 405
URL: http://mmlr.dyndns.org/changeset/405

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

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp

Modified: webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp     Fri Apr  9 
11:12:12 2010        (r404)
+++ webkit/trunk/WebKit/haiku/WebPositive/URLInputGroup.cpp     Sun Apr 11 
23:21:45 2010        (r405)
@@ -320,10 +320,10 @@
        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')

Other related posts:

  • » [haiku-webkit-commits] r405 - webkit/trunk/WebKit/haiku/WebPositive - webkit