From 8459d445065015617a45a148a5a981a68020c6db Mon Sep 17 00:00:00 2001 From: AZ Huang Date: Thu, 28 Nov 2013 20:20:52 +0800 Subject: [PATCH] Make sure friend message is null-terminated else generate garbate on screen. --- src/prompt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/prompt.c b/src/prompt.c index 3e565c0..b30bf96 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -217,6 +217,9 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int friendnum , u static void prompt_onFriendRequest(ToxWindow *self, uint8_t *key, uint8_t *data, uint16_t length) { + // make sure message data is null-terminated + data[length - 1] = 0; + wprintw(self->window, "\nFriend request with the message: %s\n", data); int n = add_friend_request(key);