From a208463e499a26370a76dcc149fe9726a5536e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Thu, 20 Sep 2018 17:23:14 +0200 Subject: [PATCH] dasdview: Replace strncpy() with memcpy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Safely replace strncpy() with memcpy() as we don't want the terminating null byte anyway. Get rid of the following warning: dasdview.c: In function ‘dasdview_print_volser’: dasdview.c:621:3: warning: ‘strncpy’ output truncated before terminating nul copying 6 bytes from a string of the same length [-Wstringop-truncation] strncpy(volser, " ", 6); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jan Höppner --- dasdview/dasdview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dasdview/dasdview.c b/dasdview/dasdview.c index d773b024..2bf08ec8 100644 --- a/dasdview/dasdview.c +++ b/dasdview/dasdview.c @@ -618,7 +618,7 @@ dasdview_print_volser(dasdview_info_t *info) strncpy(volser, vlabel.volid, 6); vtoc_ebcdic_dec(volser, volser, 6); } else { - strncpy(volser, " ", 6); + memcpy(volser, " ", 6); } printf("%6.6s\n", volser);