dasdview: Replace strncpy() with memcpy()

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 <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2018-09-20 17:23:14 +02:00
parent a931428908
commit a208463e49

View File

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