]> 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)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 22 Oct 2018 12:00:17 +0000 (14:00 +0200)
Problem reported by Martin Sebor in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00336.html
* timezone/zic.c (writezone): Use memcpy, not strncpy.

(cherry picked from commit e69897bf202e18034cbef26f363bae64de70a196)

ChangeLog
timezone/zic.c

index e2febbcce5c7c44d48ee74cfed4e8ecd50bf05b7..9109e38a85e07368a86273216b845876a7024f82 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-15  Martin Sebor  <msebor@redhat.com>
 
        * misc/sys/cdefs.h (__attribute_nonstring__): New macro.
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);