Commit 7ac5c9f0 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

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

This patch prevents snprintf from exceeding a given buffer size.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent add04a98
...@@ -983,7 +983,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj, ...@@ -983,7 +983,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj,
return ret; return ret;
if (mdev_devnod == 0 || *mdev_devnod == 0) { 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; mdev_devnod = devnod_buf;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment