]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
timezone: pacify GCC -Wstringop-truncation
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 13 Nov 2017 06:00:28 +0000 (22:00 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 13 Nov 2017 06:00:28 +0000 (22:00 -0800)
Problem reported by Martin Sebor in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00336.html
* timezone/zic.c (writezone): Use memcpy, not strncpy.

ChangeLog
timezone/zic.c

index 32b57bcd06f1b3934e6a959533737da485e2d855..fad2bd0d1c0e2694e1351af1ddf5e25f53498fca 100644 (file)
--- 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.
index 946bf6ff8e778414334107d8ace5facc000e18ad..e738386600c2383f6abbe097648f8c89ca6d96b4 100644 (file)
@@ -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);