Fixed a bug in Drawing::SetMessage

- The terminating null character of the message string is now written.
 - Along with baef257, this fully resolves #60.
This commit is contained in:
Jason Watkins
2015-04-29 12:33:10 -07:00
parent 54368bb65a
commit 2d355ebb73

View File

@@ -192,7 +192,7 @@ namespace XPC
{
//Determine size of message and clear instead if the message string
//is empty.
size_t len = strnlen(msg, MSG_MAX);
size_t len = strnlen(msg, MSG_MAX - 1);
if (len == 0)
{
ClearMessage();
@@ -200,7 +200,7 @@ namespace XPC
}
//Set the message, location, and mark new lines.
strncpy(msgVal, msg, len);
strncpy(msgVal, msg, len + 1);
newLineCount = 0;
for (size_t i = 0; i < len && newLineCount < MSG_LINE_MAX; ++i)
{