diff
minitox.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/minitox.c b/minitox.c
index 594d811..24e254c 100644
--- a/minitox.c
+++ b/minitox.c
@@ -593,7 +593,8 @@ void group_invite_cb(Tox *tox, uint32_t friend_num, TOX_CONFERENCE_TYPE type, co
memcpy(req->userdata.group.cookie, cookie, length),
req->userdata.group.length = length;
req->userdata.group.friend_num = friend_num;
- req->msg = malloc(strlen("From ") + strlen(f->name) + 1);
+ int sz = snprintf(NULL, 0, "%s%s", "From ", f->name);
+ req->msg = malloc(sz + 1);
sprintf(req->msg, "%s%s", "From ", f->name);
}
}