diff options
author | Neven Sajko <nsajko@gmail.com> | 2020-01-06 22:57:05 +0000 |
---|---|---|
committer | Dan Cross <crossd@gmail.com> | 2020-01-07 16:23:40 -0500 |
commit | e6ed10f25e4b2ea791d8e52253f7d806316420e9 (patch) | |
tree | 56951dd1bf82dc08bceed1abd00447b545cb9a08 /src/lib9 | |
parent | 540caa5873bcc3bc2a0e1896119f5b53a0e8e630 (diff) | |
download | plan9port-e6ed10f25e4b2ea791d8e52253f7d806316420e9.tar.gz plan9port-e6ed10f25e4b2ea791d8e52253f7d806316420e9.tar.bz2 plan9port-e6ed10f25e4b2ea791d8e52253f7d806316420e9.zip |
lib9, libndb: exclude terminating null from strncpy bound
GCC pointed this out with some "warning: ‘strncpy’ specified bound NUM
equals destination size [-Wstringop-truncation]" warnings.
Change-Id: Id8408b165f6e4ae82c96a77599d89f658d979b32
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/ctime.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |