From 5cde8a22f3de679ad97d683e389f418e5eccd98b Mon Sep 17 00:00:00 2001 From: dubslow Date: Thu, 2 Oct 2014 21:43:59 -0500 Subject: [PATCH] null terminate group messages (cause jfreegman can't str8 c) --- toxcore/group.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toxcore/group.c b/toxcore/group.c index 96f5ba2f..cd524e4b 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -1267,10 +1267,13 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const case PACKET_ID_MESSAGE: { if (msg_data_len == 0) return; + uint8_t newmsg[msg_data_len+1]; + memcpy(newmsg, msg_data, msg_data_len); + newmsg[msg_data_len] = 0; //TODO if (g_c->message_callback) - g_c->message_callback(g_c->m, groupnumber, index, msg_data, msg_data_len, g_c->message_callback_userdata); + g_c->message_callback(g_c->m, groupnumber, index, newmsg, msg_data_len, g_c->message_callback_userdata); break; } @@ -1470,4 +1473,4 @@ uint32_t copy_chatlist(const Messenger *m, int *out_list, uint32_t list_size) return ret; } -*/ \ No newline at end of file +*/