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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=23033

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;