summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mille/extern.c6
-rw-r--r--mille/mille.h5
-rw-r--r--mille/save.c6
-rw-r--r--phantasia/main.c15
-rw-r--r--phantasia/misc.c8
5 files changed, 24 insertions, 16 deletions
diff --git a/mille/extern.c b/mille/extern.c
index 8c568cce..da46af16 100644
--- a/mille/extern.c
+++ b/mille/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.7 2003/08/07 09:37:25 agc Exp $ */
+/* $NetBSD: extern.c,v 1.8 2009/05/25 23:17:31 dholland Exp $ */
/*
* Copyright (c) 1982, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: extern.c,v 1.7 2003/08/07 09:37:25 agc Exp $");
+__RCSID("$NetBSD: extern.c,v 1.8 2009/05/25 23:17:31 dholland Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,7 @@ bool Debug, /* set if debugging code on */
Order, /* set if hand should be sorted */
Saved; /* set if game just saved */
-char Initstr[100]; /* initial string for error field */
+char Initstr[INITSTR_SIZE]; /* initial string for error field */
const char *C_fmt = "%-18.18s", /* format for printing cards */
*Fromfile = NULL, /* startup file for game */
*const _cn[NUM_CARDS] = { /* Card name buffer */
diff --git a/mille/mille.h b/mille/mille.h
index 523d6f8e..b4e5cb38 100644
--- a/mille/mille.h
+++ b/mille/mille.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mille.h,v 1.13 2004/01/27 20:30:30 jsm Exp $ */
+/* $NetBSD: mille.h,v 1.14 2009/05/25 23:17:31 dholland Exp $ */
/*
* Copyright (c) 1982, 1993
@@ -211,7 +211,8 @@ typedef struct {
extern bool Debug, Finished, Next, On_exit, Order, Saved;
-extern char Initstr[];
+#define INITSTR_SIZE 100
+extern char Initstr[INITSTR_SIZE];
extern const char *C_fmt, *const *C_name, *Fromfile;
extern int Card_no, End, Handstart, Movetype, Numgos,
diff --git a/mille/save.c b/mille/save.c
index 1cb0592a..a2fd7be7 100644
--- a/mille/save.c
+++ b/mille/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.12 2008/01/28 05:55:10 dholland Exp $ */
+/* $NetBSD: save.c,v 1.13 2009/05/25 23:17:31 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.12 2008/01/28 05:55:10 dholland Exp $");
+__RCSID("$NetBSD: save.c,v 1.13 2009/05/25 23:17:31 dholland Exp $");
#endif
#endif /* not lint */
@@ -167,7 +167,7 @@ rest_f(file)
/*
* initialize some necessary values
*/
- (void)sprintf(Initstr, "%s [%s]\n", file, buf);
+ (void)snprintf(Initstr, INITSTR_SIZE, "%s [%s]\n", file, buf);
Fromfile = file;
return !On_exit;
}
diff --git a/phantasia/main.c b/phantasia/main.c
index d9616859..8e206d58 100644
--- a/phantasia/main.c
+++ b/phantasia/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.18 2009/05/25 23:08:45 dholland Exp $ */
+/* $NetBSD: main.c,v 1.19 2009/05/25 23:14:33 dholland Exp $ */
/*
* Phantasia 3.3.2 -- Interterminal fantasy game
@@ -647,7 +647,8 @@ titlelist(void)
Other.p_status != S_NOTUSED)
/* found the king */
{
- sprintf(Databuf, "The present ruler is %s Level:%.0f",
+ snprintf(Databuf, SZ_DATABUF,
+ "The present ruler is %s Level:%.0f",
Other.p_name, Other.p_level);
mvaddstr(4, 40 - strlen(Databuf) / 2, Databuf);
kingfound = TRUE;
@@ -662,7 +663,9 @@ titlelist(void)
if (Other.p_specialtype == SC_VALAR && Other.p_status != S_NOTUSED)
/* found the valar */
{
- sprintf(Databuf, "The Valar is %s Login: %s", Other.p_name, Other.p_login);
+ snprintf(Databuf, SZ_DATABUF,
+ "The Valar is %s Login: %s",
+ Other.p_name, Other.p_login);
mvaddstr(6, 40 - strlen(Databuf) / 2, Databuf);
break;
}
@@ -678,7 +681,8 @@ titlelist(void)
councilfound = TRUE;
}
/* This assumes a finite (<=5) number of C.O.W.: */
- sprintf(Databuf, "%s Login: %s", Other.p_name, Other.p_login);
+ snprintf(Databuf, SZ_DATABUF,
+ "%s Login: %s", Other.p_name, Other.p_login);
mvaddstr(Lines++, 40 - strlen(Databuf) / 2, Databuf);
}
/* search for the two highest players */
@@ -708,7 +712,8 @@ titlelist(void)
strcpy(nxtname, Other.p_name);
}
mvaddstr(15, 28, "Highest characters are:");
- sprintf(Databuf, "%s Level:%.0f and %s Level:%.0f",
+ snprintf(Databuf, SZ_DATABUF,
+ "%s Level:%.0f and %s Level:%.0f",
hiname, hilvl, nxtname, nxtlvl);
mvaddstr(17, 40 - strlen(Databuf) / 2, Databuf);
diff --git a/phantasia/misc.c b/phantasia/misc.c
index c8f9c1e2..881f4cc4 100644
--- a/phantasia/misc.c
+++ b/phantasia/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.16 2009/05/25 23:08:45 dholland Exp $ */
+/* $NetBSD: misc.c,v 1.17 2009/05/25 23:14:33 dholland Exp $ */
/*
* misc.c Phantasia miscellaneous support routines
@@ -133,9 +133,11 @@ descrlocation(struct player *playerp, phbool shortflag)
}
if (shortflag)
- sprintf(Databuf, "%.29s", label);
+ snprintf(Databuf, SZ_DATABUF, "%.29s", label);
else
- sprintf(Databuf, " is in %s (%.0f,%.0f)", label, playerp->p_x, playerp->p_y);
+ snprintf(Databuf, SZ_DATABUF,
+ " is in %s (%.0f,%.0f)",
+ label, playerp->p_x, playerp->p_y);
return (Databuf);
}