Skip to content

Commit 3d0129b

Browse files
tobluxgregkh
authored andcommitted
ALSA: intel_hdmi: Fix off-by-one error in __hdmi_lpe_audio_probe()
commit 8cbe564 upstream. In __hdmi_lpe_audio_probe(), strscpy() is incorrectly called with the length of the source string (excluding the NUL terminator) rather than the size of the destination buffer. This results in one character less being copied from 'card->shortname' to 'pcm->name'. Use the destination buffer size instead to ensure the card name is copied correctly. Cc: [email protected] Fixes: 75b1a8f ("ALSA: Convert strlcpy to strscpy when return value is unused") Signed-off-by: Thorsten Blum <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f92af52 commit 3d0129b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/x86/intel_hdmi_audio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ static int __hdmi_lpe_audio_probe(struct platform_device *pdev)
17681768
/* setup private data which can be retrieved when required */
17691769
pcm->private_data = ctx;
17701770
pcm->info_flags = 0;
1771-
strscpy(pcm->name, card->shortname, strlen(card->shortname));
1771+
strscpy(pcm->name, card->shortname, sizeof(pcm->name));
17721772
/* setup the ops for playback */
17731773
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &had_pcm_ops);
17741774

0 commit comments

Comments
 (0)