From owner-svn-src-all@freebsd.org Tue Sep 26 11:16:34 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 610E6E0762A; Tue, 26 Sep 2017 11:16:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2ECDD295D; Tue, 26 Sep 2017 11:16:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8QBGXGL006417; Tue, 26 Sep 2017 11:16:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8QBGX0W006416; Tue, 26 Sep 2017 11:16:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709261116.v8QBGX0W006416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 26 Sep 2017 11:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324013 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 324013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 11:16:34 -0000 Author: bapt Date: Tue Sep 26 11:16:33 2017 New Revision: 324013 URL: https://svnweb.freebsd.org/changeset/base/324013 Log: calendar: replace strcpy/strcat with asprintf Modified: head/usr.bin/calendar/events.c Modified: head/usr.bin/calendar/events.c ============================================================================== --- head/usr.bin/calendar/events.c Tue Sep 26 11:11:17 2017 (r324012) +++ head/usr.bin/calendar/events.c Tue Sep 26 11:16:33 2017 (r324013) @@ -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;