Skip to content

Commit

Permalink
timezone: pacify GCC -Wstringop-truncation
Browse files Browse the repository at this point in the history
Problem reported by Martin Sebor in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00336.html
* timezone/zic.c (writezone): Use memcpy, not strncpy.
  • Loading branch information
eggert committed Nov 13, 2017
1 parent 1ffe1cc commit e69897b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2017-11-12 Paul Eggert <[email protected]>

timezone: pacify GCC -Wstringop-truncation
Problem reported by Martin Sebor in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00336.html
* timezone/zic.c (writezone): Use memcpy, not strncpy.

2017-11-12 Florian Weimer <[email protected]>

* support/support.h (xstrndup): Declare.
Expand Down
2 changes: 1 addition & 1 deletion timezone/zic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,7 @@ writezone(const char *const name, const char *const string, char version)
}
#define DO(field) fwrite(tzh.field, sizeof tzh.field, 1, fp)
tzh = tzh0;
strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
memcpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
tzh.tzh_version[0] = version;
convert(thistypecnt, tzh.tzh_ttisgmtcnt);
convert(thistypecnt, tzh.tzh_ttisstdcnt);
Expand Down

0 comments on commit e69897b

Please sign in to comment.