Staging: most: fix snprintf() is printing too much

This patch prevents snprintf from exceeding a given buffer size.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Christian Gromm 2015-07-28 17:16:09 +02:00 committed by Greg Kroah-Hartman
parent add04a9854
commit 7ac5c9f0a0

View file

@ -983,7 +983,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj,
return ret;
if (mdev_devnod == 0 || *mdev_devnod == 0) {
snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch);
snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch);
mdev_devnod = devnod_buf;
}