mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-10 10:48:54 +00:00
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:
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| ledtrig-activity.c | ||
| ledtrig-audio.c | ||
| ledtrig-backlight.c | ||
| ledtrig-camera.c | ||
| ledtrig-cpu.c | ||
| ledtrig-default-on.c | ||
| ledtrig-disk.c | ||
| ledtrig-gpio.c | ||
| ledtrig-heartbeat.c | ||
| ledtrig-mtd.c | ||
| ledtrig-netdev.c | ||
| ledtrig-oneshot.c | ||
| ledtrig-panic.c | ||
| ledtrig-pattern.c | ||
| ledtrig-timer.c | ||
| ledtrig-transient.c | ||
| Makefile | ||