summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cribbage/io.c8
-rw-r--r--cribbage/score.c10
-rw-r--r--cribbage/support.c6
3 files changed, 13 insertions, 11 deletions
diff --git a/cribbage/io.c b/cribbage/io.c
index ea2fedba..b661f2c9 100644
--- a/cribbage/io.c
+++ b/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/cribbage/score.c b/cribbage/score.c
index 3c7b4a26..932d757d 100644
--- a/cribbage/score.c
+++ b/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/cribbage/support.c b/cribbage/support.c
index fefc4f42..e711d8b6 100644
--- a/cribbage/support.c
+++ b/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;