From 3d85b22e20fa76fb513dbfcec2a4f575e2bc13ef Mon Sep 17 00:00:00 2001 From: fox Date: Fri, 7 Feb 2020 20:34:18 +0000 Subject: 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@ --- hack/hack.end.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hack') diff --git a/hack/hack.end.c b/hack/hack.end.c index b1dca4b9..ae0e1e39 100644 --- a/hack/hack.end.c +++ b/hack/hack.end.c @@ -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 #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 @@ -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; -- cgit v1.2.3-56-ge451