]> git.baikalelectronics.ru Git - kernel.git/commit
mISDN: make sure device name is NUL terminated
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 22 May 2019 08:45:13 +0000 (11:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 May 2019 00:22:14 +0000 (17:22 -0700)
commit64b544a9233fe0caf11e4037e86f266e4f17d9da
treec00adc85e6999f71e4042645ce08d1af495f4f83
parent3466dd1b01b5e3b4e3c525219f41c7c6fbbc1b72
mISDN: make sure device name is NUL terminated

The user can change the device_name with the IMSETDEVNAME ioctl, but we
need to ensure that the user's name is NUL terminated.  Otherwise it
could result in a buffer overflow when we copy the name back to the user
with IMGETDEVINFO ioctl.

I also changed two strcpy() calls which handle the name to strscpy().
Hopefully, there aren't any other ways to create a too long name, but
it's nice to do this as a kernel hardening measure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/mISDN/socket.c