From e6ed10f25e4b2ea791d8e52253f7d806316420e9 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Mon, 6 Jan 2020 22:57:05 +0000 Subject: lib9, libndb: exclude terminating null from strncpy bound MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC pointed this out with some "warning: ‘strncpy’ specified bound NUM equals destination size [-Wstringop-truncation]" warnings. Change-Id: Id8408b165f6e4ae82c96a77599d89f658d979b32 --- src/lib9/ctime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib9') diff --git a/src/lib9/ctime.c b/src/lib9/ctime.c index a9ce7b7a..9fcd6200 100644 --- a/src/lib9/ctime.c +++ b/src/lib9/ctime.c @@ -58,7 +58,7 @@ localtime(long tim) if (zonelookuptinfo(&ti, tim)!=-1) { ct = gmtime(tim+ti.tzoff); - strncpy(ct->zone, ti.zone, sizeof ct->zone); + strncpy(ct->zone, ti.zone, sizeof ct->zone - 1); ct->zone[sizeof ct->zone-1] = 0; ct->tzoff = ti.tzoff; return ct; -- cgit v1.2.3