diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-04-06 19:59:13 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-04-06 19:59:13 +0000 |
commit | ed278f3625c5aced390722dee61459c643f6a76f (patch) | |
tree | b752e58144eb609d752c5f4d9eee6bd775264e14 /usr.bin | |
parent | e26808ef6bdd922486431af45942ab2487ac0255 (diff) |
kill strcat
ok mickey@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/calendar/io.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c index b52e728ba14..e1b7766b403 100644 --- a/usr.bin/calendar/io.c +++ b/usr.bin/calendar/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.22 2003/03/13 09:09:29 deraadt Exp $ */ +/* $OpenBSD: io.c,v 1.23 2003/04/06 19:59:12 grange Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -43,7 +43,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)calendar.c 8.3 (Berkeley) 3/25/94"; #else -static char rcsid[] = "$OpenBSD: io.c,v 1.22 2003/03/13 09:09:29 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: io.c,v 1.23 2003/04/06 19:59:12 grange Exp $"; #endif #endif /* not lint */ @@ -92,6 +92,7 @@ cal(void) char buf[2048 + 1], *prefix = NULL; struct event *events, *cur_evt, *ev1, *tmp; struct match *m; + size_t nlen; events = NULL; cur_evt = NULL; @@ -198,11 +199,10 @@ cal(void) } } else if (printing) { - if ((ev1->ldesc = realloc(ev1->ldesc, - (2 + strlen(ev1->ldesc) + strlen(buf)))) == NULL) + nlen = strlen(ev1->ldesc) + strlen(buf) + 2; + if ((ev1->ldesc = realloc(ev1->ldesc, nlen)) == NULL) err(1, NULL); - strcat(ev1->ldesc, "\n"); - strcat(ev1->ldesc, buf); + snprintf(ev1->ldesc, nlen, "%s\n%s", ev1->ldesc, buf); } } tmp = events; |