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:
parent
b289aaf66b
commit
a68045b367
|
@ -210,7 +210,7 @@ _BTextInput_::InsertText(const char* inText, int32 inLength,
|
||||||
buffer = (char*)malloc(inLength + 1);
|
buffer = (char*)malloc(inLength + 1);
|
||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
strlcpy(buffer, inText, inLength);
|
strlcpy(buffer, inText, inLength + 1);
|
||||||
|
|
||||||
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')
|
||||||
|
|
Loading…
Reference in New Issue