mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Fix a possible buffer overflow.
The buffer overflow is only theoretical since the device name is max
8 characters in length.
This fixes following gcc 7 warning:
dasdinfo.c: In function 'main':
dasdinfo.c:576:33: warning: '%s' directive writing up to 255 bytes into a
region of size 69 [-Wformat-overflow=]
sprintf(*uidfile,"/sys/block/%s/device/uid",
^~
In file included from /usr/include/stdio.h:862:0,
from dasdinfo.c:15:
/usr/include/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output
between 23 and 278 bytes into a destination of size 80
return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>