diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-07-06 02:03:14 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-07-06 02:03:14 +0000 |
commit | 257014cfb2816ded025cae21bad2effde5f7916d (patch) | |
tree | bbc18e689c2bb9dd451cb459f37c0e46e6315f8a | |
parent | 9364180cb74656ee33c9dfc24ada6b66bd4b141b (diff) |
convert some strncpy->strlcpy
pjanzen@ ok
-rw-r--r-- | games/sail/pl_main.c | 6 | ||||
-rw-r--r-- | games/sail/sync.c | 14 |
2 files changed, 9 insertions, 11 deletions
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c index bc9583ca41d..159df6a702b 100644 --- a/games/sail/pl_main.c +++ b/games/sail/pl_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pl_main.c,v 1.9 2003/06/03 03:01:41 millert Exp $ */ +/* $OpenBSD: pl_main.c,v 1.10 2003/07/06 02:03:13 avsm Exp $ */ /* $NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $ */ /* @@ -34,7 +34,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.9 2003/06/03 03:01:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: pl_main.c,v 1.10 2003/07/06 02:03:13 avsm Exp $"; #endif #endif /* not lint */ @@ -193,7 +193,7 @@ reprint: ms->shipname, mc->guns, classname[mc->class], qualname[mc->qual]); if ((nameptr = (char *) getenv("SAILNAME")) && *nameptr) - (void) strncpy(captain, nameptr, sizeof captain); + (void) strlcpy(captain, nameptr, sizeof captain); else { (void) printf("Your name, Captain? "); (void) fflush(stdout); diff --git a/games/sail/sync.c b/games/sail/sync.c index 753e5885b34..f84dcec3f5e 100644 --- a/games/sail/sync.c +++ b/games/sail/sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sync.c,v 1.6 2003/06/03 03:01:41 millert Exp $ */ +/* $OpenBSD: sync.c,v 1.7 2003/07/06 02:03:13 avsm Exp $ */ /* $NetBSD: sync.c,v 1.9 1998/08/30 09:19:40 veego Exp $ */ /* @@ -35,7 +35,7 @@ #if 0 static char sccsid[] = "@(#)sync.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: sync.c,v 1.6 2003/06/03 03:01:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: sync.c,v 1.7 2003/07/06 02:03:13 avsm Exp $"; #endif #endif /* not lint */ @@ -393,9 +393,8 @@ sync_update(type, ship, astr, a, b, c, d) break; } case W_CAPTAIN: - (void) strncpy(ship->file->captain, astr, - sizeof ship->file->captain - 1); - ship->file->captain[sizeof ship->file->captain - 1] = 0; + (void) strlcpy(ship->file->captain, astr, + sizeof ship->file->captain); break; case W_CAPTURED: if (a < 0) @@ -432,9 +431,8 @@ sync_update(type, ship, astr, a, b, c, d) ship->specs->hull = a; break; case W_MOVE: - (void) strncpy(ship->file->movebuf, astr, - sizeof ship->file->movebuf - 1); - ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0; + (void) strlcpy(ship->file->movebuf, astr, + sizeof ship->file->movebuf); break; case W_PCREW: ship->file->pcrew = a; |