Fix sizeof/strlen typo and limit scanf length.

scanf spotted by:	Aarn Bornstein <aaronb@j51.com>
This commit is contained in:
Eivind Eklund 1997-02-23 05:15:52 +00:00
parent 6397b46dd2
commit a98e812bb8

View File

@ -202,7 +202,7 @@ initialize()
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 @@ initialize()
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;