Instead of silently setting the string value to NULL, we fail completely in
sending the message to notify the user.
Fixes #844.
{
unsigned long string_start = msg->length;
- if (string == NULL || msg->length + strlen(string) >= sizeof(stroke_msg_t))
+ if (string == NULL)
{
return NULL;
}
+ else if ((size_t)msg->length + strlen(string) >= sizeof(stroke_msg_t))
+ {
+ /* set invalid length to fail during message send */
+ msg->length = ~0;
+ return NULL;
+ }
else
{
msg->length += strlen(string) + 1;
char *uri, buffer[64];
int count;
+ if (msg->length > sizeof(stroke_msg_t))
+ {
+ DBG1(DBG_APP, "stroke message exceeds buffer size");
+ return -1;
+ }
+
/* starter is not called from commandline, and therefore absolutely silent */
msg->output_verbosity = -1;