about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--timezone/zic.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 32b57bcd06..fad2bd0d1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+	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  <fweimer@redhat.com>
 
 	* support/support.h (xstrndup): Declare.
diff --git a/timezone/zic.c b/timezone/zic.c
index 946bf6ff8e..e738386600 100644
--- a/timezone/zic.c
+++ b/timezone/zic.c
@@ -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);