summaryrefslogtreecommitdiff
path: root/.get_maintainer.ignore
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2019-03-14 15:06:14 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-04 09:21:23 +0200
commit310f9b1e52c00715b0413bc47deeb2c997da1fcf (patch)
treee637bda9dbfd6294a1d122eefe2b7e6b9411ff0a /.get_maintainer.ignore
parent004ec01370bc183a83d715d975aa742d99a556f0 (diff)
leds: trigger: netdev: use memcpy in device_name_store
[ Upstream commit 909346433064b8d840dc82af26161926b8d37558 ] If userspace doesn't end the input with a newline (which can easily happen if the write happens from a C program that does write(fd, iface, strlen(iface))), we may end up including garbage from a previous, longer value in the device_name. For example # cat device_name # printf 'eth12' > device_name # cat device_name eth12 # printf 'eth3' > device_name # cat device_name eth32 I highly doubt anybody is relying on this behaviour, so switch to simply copying the bytes (we've already checked that size is < IFNAMSIZ) and unconditionally zero-terminate it; of course, we also still have to strip a trailing newline. This is also preparation for future patches. Fixes: 06f502f57d0d ("leds: trigger: Introduce a NETDEV trigger") Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
Diffstat (limited to '.get_maintainer.ignore')
0 files changed, 0 insertions, 0 deletions