diff --git a/games/cribbage/io.c b/games/cribbage/io.c index ea2fedbaf131..b661f2c93820 100644 --- a/games/cribbage/io.c +++ b/games/cribbage/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.21 2007/12/15 19:44:39 perry Exp $ */ +/* $NetBSD: io.c,v 1.22 2009/06/04 04:48:04 dholland Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: io.c,v 1.21 2007/12/15 19:44:39 perry Exp $"); +__RCSID("$NetBSD: io.c,v 1.22 2009/06/04 04:48:04 dholland Exp $"); #endif #endif /* not lint */ @@ -367,7 +367,7 @@ msg(const char *fmt, ...) va_list ap; va_start(ap, fmt); - (void)vsprintf(&Msgbuf[Newpos], fmt, ap); + (void)vsnprintf(&Msgbuf[Newpos], sizeof(Msgbuf)-Newpos, fmt, ap); Newpos = strlen(Msgbuf); va_end(ap); endmsg(); @@ -383,7 +383,7 @@ addmsg(const char *fmt, ...) va_list ap; va_start(ap, fmt); - (void)vsprintf(&Msgbuf[Newpos], fmt, ap); + (void)vsnprintf(&Msgbuf[Newpos], sizeof(Msgbuf)-Newpos, fmt, ap); Newpos = strlen(Msgbuf); va_end(ap); } diff --git a/games/cribbage/score.c b/games/cribbage/score.c index 3c7b4a2671c2..932d757d514d 100644 --- a/games/cribbage/score.c +++ b/games/cribbage/score.c @@ -1,4 +1,4 @@ -/* $NetBSD: score.c,v 1.13 2007/12/15 19:44:39 perry Exp $ */ +/* $NetBSD: score.c,v 1.14 2009/06/04 04:48:04 dholland Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: score.c,v 1.13 2007/12/15 19:44:39 perry Exp $"); +__RCSID("$NetBSD: score.c,v 1.14 2009/06/04 04:48:04 dholland Exp $"); #endif #endif /* not lint */ @@ -153,7 +153,8 @@ scorehand(const CARD hand[], CARD starter, int n, BOOLEAN crb, hscore += i; if (do_explain) { if (i > 0) { - (void) sprintf(buf, "%d points in fifteens", i); + (void) snprintf(buf, sizeof(buf), + "%d points in fifteens", i); strcat(explan, buf); } else strcat(explan, "No fifteens"); @@ -162,7 +163,8 @@ scorehand(const CARD hand[], CARD starter, int n, BOOLEAN crb, hscore += i; if (do_explain) { if (i > 0) { - (void) sprintf(buf, ", %d points in pairs, %d in runs", + (void) snprintf(buf, sizeof(buf), + ", %d points in pairs, %d in runs", pairpoints, runpoints); strcat(explan, buf); } else diff --git a/games/cribbage/support.c b/games/cribbage/support.c index fefc4f425525..e711d8b6c911 100644 --- a/games/cribbage/support.c +++ b/games/cribbage/support.c @@ -1,4 +1,4 @@ -/* $NetBSD: support.c,v 1.12 2006/03/20 12:32:21 rtr Exp $ */ +/* $NetBSD: support.c,v 1.13 2009/06/04 04:48:04 dholland Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: support.c,v 1.12 2006/03/20 12:32:21 rtr Exp $"); +__RCSID("$NetBSD: support.c,v 1.13 2009/06/04 04:48:04 dholland Exp $"); #endif #endif /* not lint */ @@ -134,7 +134,7 @@ plyrhand(const CARD hand[], const char *s) BOOLEAN win; prhand(hand, CINHAND, Playwin, FALSE); - (void) sprintf(prompt, "Your %s scores ", s); + (void) snprintf(prompt, sizeof(prompt), "Your %s scores ", s); i = scorehand(hand, turnover, CINHAND, strcmp(s, "crib") == 0, explain); if ((j = number(0, 29, prompt)) == 19) j = 0;