public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [2.26 COMMITTED] timezone: pacify GCC -Wstringop-truncation
@ 2018-01-01  0:00 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2018-01-01  0:00 UTC (permalink / raw)
  To: libc-stable

From: Paul Eggert <eggert@cs.ucla.edu>

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)

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.

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-22 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-01  0:00 [2.26 COMMITTED] timezone: pacify GCC -Wstringop-truncation Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).