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
This commit is contained in:
parent
540caa5873
commit
e6ed10f25e
2 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue