diff mbox

[3/3] ASoC: 88pm860x-codec: Fix possibly missing string termination

Message ID 1412682085-5217-4-git-send-email-daniel@zonque.org (mailing list archive)
State Accepted
Commit 77eca3cd461da663945eceddf454466a609d8ca4
Headers show

Commit Message

Daniel Mack Oct. 7, 2014, 11:41 a.m. UTC
Coverity spotted an issue with strncpy() in pm860x_codec_probe()
which does not take the \0 termination byte into account. Fix this
by making the buffers one byte larger so the can really accommodate
MAX_NAME_LEN bytes long strings.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 sound/soc/codecs/88pm860x-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Oct. 7, 2014, 12:13 p.m. UTC | #1
On Tue, Oct 07, 2014 at 01:41:25PM +0200, Daniel Mack wrote:
> Coverity spotted an issue with strncpy() in pm860x_codec_probe()
> which does not take the \0 termination byte into account. Fix this
> by making the buffers one byte larger so the can really accommodate
> MAX_NAME_LEN bytes long strings.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 4c3b0af..e88a6b6 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -146,7 +146,7 @@  struct pm860x_priv {
 	struct pm860x_det	det;
 
 	int			irq[4];
-	unsigned char		name[4][MAX_NAME_LEN];
+	unsigned char		name[4][MAX_NAME_LEN+1];
 };
 
 /* -9450dB to 0dB in 150dB steps ( mute instead of -9450dB) */