mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 04:48:02 +02:00
evdev: prevent unterminated device name
The kernel copies up to sizeof(devname) bytes but doesn't null-terminate the string if the device name exceeds the size of the supplied buffer.
This commit is contained in:
parent
297bac9802
commit
756785ec3e
1 changed files with 1 additions and 0 deletions
|
|
@ -575,6 +575,7 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
|
||||||
device->fd = device_fd;
|
device->fd = device_fd;
|
||||||
|
|
||||||
ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname);
|
ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname);
|
||||||
|
devname[sizeof(devname) - 1] = '\0';
|
||||||
device->devname = strdup(devname);
|
device->devname = strdup(devname);
|
||||||
|
|
||||||
if (!evdev_handle_device(device)) {
|
if (!evdev_handle_device(device)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue