summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-12-28 04:51:40 +0000
committerjkh <jkh@FreeBSD.org>1995-12-28 04:51:40 +0000
commit3cebea6eb99141a9d64c9f481cdb7d89a6a62066 (patch)
treeb652314a55bb820ea193c1b3bddb9cfe43941d67
parentd046612fefbc20db688fafd95c0cb335439c146a (diff)
downloadFreeBSD-src-3cebea6eb99141a9d64c9f481cdb7d89a6a62066.zip
FreeBSD-src-3cebea6eb99141a9d64c9f481cdb7d89a6a62066.tar.gz
Truncate the fgets() return properly.
-rw-r--r--games/sail/pl_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index e921321..02faa79 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -201,8 +201,9 @@ reprint:
(void) fgets(captain, sizeof captain, stdin);
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++) {
char buf[10];
OpenPOWER on IntegriCloud