diff options
| author | Rasmus Villemoes <[email protected]> | 2019-03-14 14:06:14 +0000 |
|---|---|---|
| committer | Jacek Anaszewski <[email protected]> | 2019-03-30 18:09:32 +0000 |
| commit | 909346433064b8d840dc82af26161926b8d37558 (patch) | |
| tree | a00e6c4fe49136d7c79c2b294e441e78eb121f92 /tools/perf/scripts/python/sched-migration.py | |
| parent | leds: pca9532: fix a potential NULL pointer dereference (diff) | |
| download | kernel-909346433064b8d840dc82af26161926b8d37558.tar.gz kernel-909346433064b8d840dc82af26161926b8d37558.zip | |
leds: trigger: netdev: use memcpy in device_name_store
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 <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/sched-migration.py')
0 files changed, 0 insertions, 0 deletions
