From 7ac5c9f0a0228fff35c0ea85008ff642b07e6db3 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Tue, 28 Jul 2015 17:16:09 +0200 Subject: [PATCH] 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 --- drivers/staging/most/mostcore/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.34.1