From a68045b3675b435a40b1cf1122bb1ed6638ca5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 12 Apr 2010 14:18:13 +0000 Subject: [PATCH] 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 --- src/kits/interface/TextInput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kits/interface/TextInput.cpp b/src/kits/interface/TextInput.cpp index f1bbd6f1e3..781214f451 100644 --- a/src/kits/interface/TextInput.cpp +++ b/src/kits/interface/TextInput.cpp @@ -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')