Revision 909346433064b8d840dc82af26161926b8d37558 authored by Rasmus Villemoes on 14 March 2019, 14:06:14 UTC, committed by Jacek Anaszewski on 30 March 2019, 18:09:32 UTC
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>
1 parent 0aab8e4
File | Mode | Size |
---|---|---|
Kconfig | -rw-r--r-- | 667 bytes |
Makefile | -rw-r--r-- | 209 bytes |
aica.c | -rw-r--r-- | 18.0 KB |
aica.h | -rw-r--r-- | 2.3 KB |
sh_dac_audio.c | -rw-r--r-- | 10.9 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...