git.strcat.st

/strcat/minitox.git/ - summarytreelogarchive

subject
bugfix: f->name is null
commit
48fba6dbfbb46e88c5683b5ac56649389a789a4d
date
2018-06-29T11:05:56Z
message
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);
     }
 }