summaryrefslogtreecommitdiffstats
path: root/games/sail
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1997-02-23 05:15:52 +0000
committereivind <eivind@FreeBSD.org>1997-02-23 05:15:52 +0000
commitee4a78d281e83c31cca7c79048eb51cf7d651c00 (patch)
tree60f3ba00fca95f599821ffcac217926c00c9f296 /games/sail
parent9b98797d2988c73c3264b3c18a8268a7168be61b (diff)
downloadFreeBSD-src-ee4a78d281e83c31cca7c79048eb51cf7d651c00.zip
FreeBSD-src-ee4a78d281e83c31cca7c79048eb51cf7d651c00.tar.gz
Fix sizeof/strlen typo and limit scanf length.
scanf spotted by: Aarn Bornstein <aaronb@j51.com>
Diffstat (limited to 'games/sail')
-rw-r--r--games/sail/pl_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index 02faa79..4f57121 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -202,7 +202,7 @@ reprint:
if (!*captain)
(void) strcpy(captain, "no name");
else
- captain[strlen(captain) - 1] = '\0';
+ captain[sizeof(captain) - 1] = '\0';
}
Write(W_CAPTAIN, ms, 1, (int)captain, 0, 0, 0);
for (n = 0; n < 2; n++) {
@@ -211,7 +211,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;
OpenPOWER on IntegriCloud