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

Commit de8eae36 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[media] media: Use strlcpy instead of custom code



Replace strncpy + manually setting the terminating '\0' with an strlcpy
call.

Reported-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 62ea864f
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -103,10 +103,8 @@ static long media_device_enum_entities(struct media_device *mdev,
		return -EINVAL;

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