calendar: replace strcpy/strcat with asprintf

This commit is contained in:
Baptiste Daroussin 2017-09-26 11:16:33 +00:00
parent 89b859e39a
commit 65d4f317ea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324013

View File

@ -86,12 +86,9 @@ event_continue(struct event *e, char *txt)
errx(1, "event_continue: cannot allocate memory");
free(e->text);
e->text = (char *)malloc(strlen(text) + strlen(txt) + 3);
asprintf(&e->text, "%s\n%s", text, txt);
if (e->text == NULL)
errx(1, "event_continue: cannot allocate memory");
strcpy(e->text, text);
strcat(e->text, "\n");
strcat(e->text, txt);
free(text);
return;