Skip to content

Commit

Permalink
Fix memory corruption in zmq mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Barnaby Gray committed Mar 5, 2013
1 parent b827018 commit 30ec722
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions wmr100.c
Expand Up @@ -279,10 +279,8 @@ void wmr_output_zmq(WMR *wmr, char *topic, char *msg) {
/* message format is: topic\0json, for pubsub subscription matching */
data = (char *)zmq_msg_data(&zmsg);
strcpy(data, topic);
data += strlen(topic);
data[0] = '\0';
data += 1;
strcpy(data, msg);
data += strlen(topic) + 1;
memcpy(data, msg, strlen(msg));
zmq_send(wmr->zmq_sock, &zmsg, 0);
zmq_msg_close(&zmsg);
}
Expand Down

0 comments on commit 30ec722

Please sign in to comment.