Module Name:    src
Committed By:   fox
Date:           Fri Feb  7 20:34:18 UTC 2020

Modified Files:
        src/games/hack: hack.end.c

Log Message:
games/hack:  Fix -Wstringop-truncation warning.

Replace strncpy(3) with strlcpy(3).

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/games/hack/hack.end.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/hack/hack.end.c
diff -u src/games/hack/hack.end.c:1.17 src/games/hack/hack.end.c:1.18
--- src/games/hack/hack.end.c:1.17	Sat Aug  6 20:42:43 2011
+++ src/games/hack/hack.end.c	Fri Feb  7 20:34:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hack.end.c,v 1.17 2011/08/06 20:42:43 dholland Exp $	*/
+/*	$NetBSD: hack.end.c,v 1.18 2020/02/07 20:34:18 fox Exp $	*/
 
 /*
  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hack.end.c,v 1.17 2011/08/06 20:42:43 dholland Exp $");
+__RCSID("$NetBSD: hack.end.c,v 1.18 2020/02/07 20:34:18 fox Exp $");
 #endif				/* not lint */
 
 #include <signal.h>
@@ -362,7 +362,7 @@ topten(void)
 	t0->plchar = pl_character[0];
 	t0->sex = (flags.female ? 'F' : 'M');
 	t0->uid = uid;
-	(void) strncpy(t0->name, plname, NAMSZ);
+	(void) strlcpy(t0->name, plname, NAMSZ);
 	(t0->name)[NAMSZ] = 0;
 	(void) strncpy(t0->death, killer, DTHSZ);
 	(t0->death)[DTHSZ] = 0;

Reply via email to