From c2297a0a7eeadda0363fb93c2421b3ea6cdb5419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Mon, 5 Nov 2018 13:20:59 +0100 Subject: [PATCH] zgetdump: Replace strncpy() with memcpy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can safely replace strncpy() with memcpy() here and get rid of the following compile warnings: dfi_s390mv.c: In function ‘set_magic_numbers’: dfi_s390mv.c:570:3: warning: ‘strncpy’ output truncated before terminating nul copying 7 bytes fr om a string of the same length [-Wstringop-truncation] strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dfi_s390mv.c:573:3: warning: ‘strncpy’ output truncated before terminating nul copying 7 bytes fr om a string of the same length [-Wstringop-truncation] strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jan Höppner --- zdump/dfi_s390mv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zdump/dfi_s390mv.c b/zdump/dfi_s390mv.c index 6d14727c..74c76e76 100644 --- a/zdump/dfi_s390mv.c +++ b/zdump/dfi_s390mv.c @@ -568,10 +568,10 @@ static void set_magic_numbers(void) { if (l.extended) { l.magic_number = DF_S390_MAGIC_EXT; - strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7); + memcpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7); } else { l.magic_number = DF_S390_MAGIC; - strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7); + memcpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7); } }