Browse Source

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>
Christian Gromm 10 years ago
parent
commit
7ac5c9f0a0
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/staging/most/mostcore/core.c

+ 1 - 1
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;
 	}