Files
s390-tools/dasdview
Dan Horák daf02f75b1 dasdview: fix string truncation warning
Replace strncpy() with util_strlcpy() which provides the required
semantic.

In function ‘dasdview_print_format1’,
    inlined from ‘dasdview_view_standard’ at dasdview.c:1952:4,
    inlined from ‘dasdview_view’ at dasdview.c:2165:3,
    inlined from ‘main’ at dasdview.c:2364:3:
dasdview.c:1791:25: warning: ‘strncpy’ output may be truncated copying 16 bytes from a string of length 1023 [-Wstringop-truncation]
 1791 |                         strncpy(asc, (char *)dumpstr + i, 16);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dasdview.c:1792:25: warning: ‘strncpy’ output may be truncated copying 16 bytes from a string of length 1023 [-Wstringop-truncation]
 1792 |                         strncpy(ebc, (char *)dumpstr + i, 16);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘dasdview_print_format2’,
    inlined from ‘dasdview_view_standard’ at dasdview.c:1935:4,
    inlined from ‘dasdview_view’ at dasdview.c:2165:3,
    inlined from ‘main’ at dasdview.c:2364:3:
dasdview.c:1825:25: warning: ‘strncpy’ output may be truncated copying 8 bytes from a string of length 1023 [-Wstringop-truncation]
 1825 |                         strncpy(asc, (char *)dumpstr + i, 8);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dasdview.c:1826:25: warning: ‘strncpy’ output may be truncated copying 8 bytes from a string of length 1023 [-Wstringop-truncation]
 1826 |                         strncpy(ebc, (char *)dumpstr + i, 8);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GitHub-ID: https://github.com/ibm-s390-linux/s390-tools/pull/137
Signed-off-by: Dan Horák <dan@danny.cz>
[hoeppner@linux.ibm.com: sort include]
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-07-21 15:57:17 +02:00
..
2017-08-21 10:55:40 +02:00