summaryrefslogtreecommitdiff
path: root/games/sail
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1999-03-26 02:35:54 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1999-03-26 02:35:54 +0000
commit0c8b4d3543c98c9bd92b8b0556004f77fc33bdfb (patch)
tree2cf2aba384dbe5239ce4d6ac8f71851c779217af /games/sail
parentbe640b50041bf2b888baea9a892a150ebeddfbbb (diff)
fix sizeof/strlen typo and limit scanf length; from FreeBSD
Diffstat (limited to 'games/sail')
-rw-r--r--games/sail/pl_main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index 77781f56504..9f2dfc3a839 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pl_main.c,v 1.3 1999/01/18 06:20:53 pjanzen Exp $ */
+/* $OpenBSD: pl_main.c,v 1.4 1999/03/26 02:35:53 pjanzen Exp $ */
/* $NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: pl_main.c,v 1.3 1999/01/18 06:20:53 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: pl_main.c,v 1.4 1999/03/26 02:35:53 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -64,7 +64,7 @@ initialize()
{
struct File *fp;
struct ship *sp;
- char captain[80];
+ char captain[20];
char message[60];
int load;
int n;
@@ -201,9 +201,8 @@ reprint:
if (!*captain)
(void) strcpy(captain, "no name");
else
- captain[strlen(captain) - 1] = '\0';
+ captain[sizeof(captain) - 1] = '\0';
}
- captain[sizeof captain - 1] = '\0';
Writestr(W_CAPTAIN, ms, captain);
for (n = 0; n < 2; n++) {
char buf[10];
@@ -211,7 +210,7 @@ reprint:
printf("\nInitial broadside %s (grape, chain, round, double): ",
n ? "right" : "left");
(void) fflush(stdout);
- (void) scanf("%s", buf);
+ (void) scanf("%9s", buf);
switch (*buf) {
case 'g':
load = L_GRAPE;