mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user