diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-04-13 18:53:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-04-13 18:53:00 +0000 |
commit | 12544acbc4af57fc96723a71b150feabf09891fc (patch) | |
tree | 72ebdd9275eef55b2f400bfb986b64731a58580c /usr.bin | |
parent | eb9b1bde6e316f3c73b475a1602a65fc9561a538 (diff) |
do not trust snprintf return value; ok otto mickey
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cal/cal.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/cal/cal.c b/usr.bin/cal/cal.c index ef33b217d53..7a4519dd877 100644 --- a/usr.bin/cal/cal.c +++ b/usr.bin/cal/cal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cal.c,v 1.10 2003/06/10 22:20:45 deraadt Exp $ */ +/* $OpenBSD: cal.c,v 1.11 2005/04/13 18:52:59 deraadt Exp $ */ /* $NetBSD: cal.c,v 1.6 1995/03/26 03:10:24 glass Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cal.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: cal.c,v 1.10 2003/06/10 22:20:45 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cal.c,v 1.11 2005/04/13 18:52:59 deraadt Exp $"; #endif #endif /* not lint */ @@ -200,8 +200,9 @@ monthly(int month, int year) char *p, lineout[30]; day_array(month, year, days); - len = snprintf(lineout, sizeof lineout, "%s %d", + (void) snprintf(lineout, sizeof lineout, "%s %d", month_names[month - 1], year); + len = strlen(lineout); (void)printf("%*s%s\n%s\n", ((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "", lineout, julian ? j_day_headings : day_headings); |