staging/fbtft: Remove all strcpy() uses
authorLen Baker <len.baker@gmx.com>
Sun, 1 Aug 2021 08:51:53 +0000 (10:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Aug 2021 11:05:57 +0000 (13:05 +0200)
commitb888897014a9986726b7f8d69356097722834c04
treec2b1c031a94aa0db67af70e66d3f4057631ba511
parent96ac47d2418d32bb8a7aff5973bd5d3375775897
staging/fbtft: Remove all strcpy() uses

strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. The safe replacement is strscpy() but in
this case it is simpler to use the "%*ph" format specifier.

Moreover, with the "0x%02X " in the sprintf followed by the strcat, the
msg buffer (now removed) can print 128/5 values (25 hex values). So, the
"%*ph" replacement won't cut output earlier than requested since this
format specifier can print up to 64 bytes.

Signed-off-by: Len Baker <len.baker@gmx.com>
Link: https://lore.kernel.org/r/20210801085155.3170-2-len.baker@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-core.c