Include the terminating 0 byte when adding as string type. Otherwise someone
reading the message as an actual string will run into problems. Should fix #4697. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33442 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -735,7 +735,7 @@ KeyboardDevice::_ControlThread()
|
|||||||
if (numBytes > 0) {
|
if (numBytes > 0) {
|
||||||
for (int i = 0; i < numBytes; i++)
|
for (int i = 0; i < numBytes; i++)
|
||||||
msg->AddInt8("byte", (int8)string[i]);
|
msg->AddInt8("byte", (int8)string[i]);
|
||||||
msg->AddData("bytes", B_STRING_TYPE, string, numBytes);
|
msg->AddData("bytes", B_STRING_TYPE, string, numBytes + 1);
|
||||||
|
|
||||||
if (rawNumBytes <= 0) {
|
if (rawNumBytes <= 0) {
|
||||||
rawNumBytes = 1;
|
rawNumBytes = 1;
|
||||||
|
|||||||
@@ -1117,7 +1117,7 @@ FrameMoved(origin);
|
|||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
if (msg->FindData("bytes", B_STRING_TYPE,
|
if (msg->FindData("bytes", B_STRING_TYPE,
|
||||||
(const void**)&string, &bytes) == B_OK) {
|
(const void**)&string, &bytes) == B_OK) {
|
||||||
view->KeyDown(string, bytes);
|
view->KeyDown(string, bytes - 1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
target->MessageReceived(msg);
|
target->MessageReceived(msg);
|
||||||
@@ -1133,7 +1133,7 @@ FrameMoved(origin);
|
|||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
if (msg->FindData("bytes", B_STRING_TYPE,
|
if (msg->FindData("bytes", B_STRING_TYPE,
|
||||||
(const void**)&string, &bytes) == B_OK) {
|
(const void**)&string, &bytes) == B_OK) {
|
||||||
view->KeyUp(string, bytes);
|
view->KeyUp(string, bytes - 1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
target->MessageReceived(msg);
|
target->MessageReceived(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user