Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cc8d841 authored by Brian Norris's avatar Brian Norris
Browse files

mtd: terminate user-provided string



Noticed by Coverity as a potential security issue.

Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 537ab1bd
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -549,6 +549,9 @@ static int mtdchar_blkpg_ioctl(struct mtd_info *mtd,
		if (mtd_is_partition(mtd))
		if (mtd_is_partition(mtd))
			return -EINVAL;
			return -EINVAL;


		/* Sanitize user input */
		p.devname[BLKPG_DEVNAMELTH - 1] = '\0';

		return mtd_add_partition(mtd, p.devname, p.start, p.length);
		return mtd_add_partition(mtd, p.devname, p.start, p.length);


	case BLKPG_DEL_PARTITION:
	case BLKPG_DEL_PARTITION: