From: Christian Gromm Date: Tue, 28 Jul 2015 15:16:09 +0000 (+0200) Subject: Staging: most: fix snprintf() is printing too much X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7ac5c9f0a0228fff35c0ea85008ff642b07e6db3;p=linux-beck.git Staging: most: fix snprintf() is printing too much This patch prevents snprintf from exceeding a given buffer size. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index 98a4c900d1c2..49d03af599d5 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -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; }