Strings in BMessages don't necessarily have to be \0 terminated. Use the already
known length to print the stream so printf() doesn't potentially crash when trying a strlen() on the string. Fixes for example printing B_KEY_DOWN messages, where such strings are used, in certain conditions. Review welcome, printf() formatting is not one of my strengths. :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35629 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3fbef6e0ec
commit
e8e5e0caa0
@ -590,8 +590,8 @@ BMessage::_PrintToStream(const char* indent) const
|
||||
break;
|
||||
|
||||
case B_STRING_TYPE:
|
||||
printf("string(\"%s\", %ld bytes)\n", (char *)pointer,
|
||||
(long)size);
|
||||
printf("string(\"%.*s\", %ld bytes)\n", (int)size,
|
||||
(char *)pointer, (long)size);
|
||||
break;
|
||||
|
||||
case B_INT8_TYPE:
|
||||
|
Loading…
Reference in New Issue
Block a user