From: Peter Hutterer Date: Wed, 7 Aug 2013 01:04:41 +0000 (+1000) Subject: evdev: prevent unterminated device name X-Git-Tag: 0.1.0~163^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=756785ec3eb5643a73fc9556eb67227b4e4623e4;p=platform%2Fupstream%2Flibinput.git 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. --- diff --git a/src/evdev.c b/src/evdev.c index fc5004c..27296f8 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -575,6 +575,7 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd) device->fd = device_fd; ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname); + devname[sizeof(devname) - 1] = '\0'; device->devname = strdup(devname); if (!evdev_handle_device(device)) {