strlcpy() takes buffer size and will copy buffer size - 1 chars at max and then

use the remaining byte to terminate the buffer. Thanks for the heads up!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36185 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-04-12 14:18:13 +00:00
parent b289aaf66b
commit a68045b367
1 changed files with 1 additions and 1 deletions

View File

@ -210,7 +210,7 @@ _BTextInput_::InsertText(const char* inText, int32 inLength,
buffer = (char*)malloc(inLength + 1);
if (buffer) {
strlcpy(buffer, inText, inLength);
strlcpy(buffer, inText, inLength + 1);
for (int32 i = 0; i < inLength; i++) {
if (buffer[i] == '\r' || buffer[i] == '\n')