Skip to content

Commit 48fba6d

Browse files
committed
bugfix: f->name is null
1 parent fb15cc2 commit 48fba6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

minitox.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,8 @@ void group_invite_cb(Tox *tox, uint32_t friend_num, TOX_CONFERENCE_TYPE type, co
593593
memcpy(req->userdata.group.cookie, cookie, length),
594594
req->userdata.group.length = length;
595595
req->userdata.group.friend_num = friend_num;
596-
req->msg = malloc(strlen("From ") + strlen(f->name) + 1);
596+
int sz = snprintf(NULL, 0, "%s%s", "From ", f->name);
597+
req->msg = malloc(sz + 1);
597598
sprintf(req->msg, "%s%s", "From ", f->name);
598599
}
599600
}

0 commit comments

Comments
 (0)