Module Name:    src
Committed By:   dholland
Date:           Thu Jun  4 04:48:04 UTC 2009

Modified Files:
        src/games/cribbage: io.c score.c support.c

Log Message:
sprintf -> snprintf


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/games/cribbage/io.c
cvs rdiff -u -r1.13 -r1.14 src/games/cribbage/score.c
cvs rdiff -u -r1.12 -r1.13 src/games/cribbage/support.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/cribbage/io.c
diff -u src/games/cribbage/io.c:1.21 src/games/cribbage/io.c:1.22
--- src/games/cribbage/io.c:1.21	Sat Dec 15 19:44:39 2007
+++ src/games/cribbage/io.c	Thu Jun  4 04:48:04 2009
@@ -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 @@
 	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 @@
 	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);
 }

Index: src/games/cribbage/score.c
diff -u src/games/cribbage/score.c:1.13 src/games/cribbage/score.c:1.14
--- src/games/cribbage/score.c:1.13	Sat Dec 15 19:44:39 2007
+++ src/games/cribbage/score.c	Thu Jun  4 04:48:04 2009
@@ -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 @@
 	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 @@
 	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

Index: src/games/cribbage/support.c
diff -u src/games/cribbage/support.c:1.12 src/games/cribbage/support.c:1.13
--- src/games/cribbage/support.c:1.12	Mon Mar 20 12:32:21 2006
+++ src/games/cribbage/support.c	Thu Jun  4 04:48:04 2009
@@ -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 @@
 	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;

Reply via email to