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

Commit c06ca8f9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab
Browse files

[media] media: info leak in media_device_enum_entities()



The last part of the "u_ent.name" buffer isn't cleared so it still has
uninitialized stack memory.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 59501bb7
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -102,9 +102,12 @@ static long media_device_enum_entities(struct media_device *mdev,
		return -EINVAL;

	u_ent.id = ent->id;
	u_ent.name[0] = '\0';
	if (ent->name)
		strlcpy(u_ent.name, ent->name, sizeof(u_ent.name));
	if (ent->name) {
		strncpy(u_ent.name, ent->name, sizeof(u_ent.name));
		u_ent.name[sizeof(u_ent.name) - 1] = '\0';
	} else {
		memset(u_ent.name, 0, sizeof(u_ent.name));
	}
	u_ent.type = ent->type;
	u_ent.revision = ent->revision;
	u_ent.flags = ent->flags;