Skip to content

Commit

Permalink
ASoC: fsl: use strncpy() to prevent copying of over-long names
Browse files Browse the repository at this point in the history
Use strncpy() instead of strcpy(). That's not a security issue, as the
source buffer is taken from DT nodes, but we should still enforce bound
checks. Spotted by Coverity.

Signed-off-by: Daniel Mack <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
zonque authored and broonie committed Oct 22, 2014
1 parent f114040 commit 6aa256b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sound/soc/fsl/fsl_asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
return -ENOMEM;

asrc_priv->pdev = pdev;
strcpy(asrc_priv->name, np->name);
strncpy(asrc_priv->name, np->name, sizeof(asrc_priv->name) - 1);

/* Get the addresses and IRQ */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/fsl/fsl_esai.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
return -ENOMEM;

esai_priv->pdev = pdev;
strcpy(esai_priv->name, np->name);
strncpy(esai_priv->name, np->name, sizeof(esai_priv->name) - 1);

/* Get the addresses and IRQ */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand Down

0 comments on commit 6aa256b

Please sign in to comment.