Skip to contentSkip to conversation

drivers/staging/media/go7007: using strlcpy instead of strncpy

PATCH New Chen Gang 1 participant 1 message Mar 20, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 drivers/staging/media/go7007: using strlcpy instead of strncpy

better to treate them as NUL terminated string.

---
 drivers/staging/media/go7007/go7007-v4l2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/go7007/go7007-v4l2.c +2 -2
index cb9fe33..9050e19 100644
@@ -637,7 +637,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
 	fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	fmt->flags = V4L2_FMT_FLAG_COMPRESSED;
 
-	strncpy(fmt->description, desc, sizeof(fmt->description));
+	strlcpy(fmt->description, desc, sizeof(fmt->description));
 
 	return 0;
 }
@@ -1181,7 +1181,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
 	if (inp->index >= go->board_info->num_inputs)
 		return -EINVAL;
 
-	strncpy(inp->name, go->board_info->inputs[inp->index].name,
+	strlcpy(inp->name, go->board_info->inputs[inp->index].name,
 			sizeof(inp->name));
 
 	/* If this board has a tuner, it will be the last input */
Signature · 1 line
1.7.7.6