mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
usb: gadget: u_audio: fix the risk of strcpy out of bounds
We use strlcpy instead of strcpy to ensure that array won't out
of bounds.
Fixes: a322b6c50d (FROMLIST: usb: gadget: f_uac*: Support multiple sampling rates)
Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Change-Id: Iebda94fea94dc929320273c16de996ff0d2d6397
This commit is contained in:
@@ -416,7 +416,7 @@ static struct snd_kcontrol *u_audio_get_ctl(struct g_audio *audio_dev,
|
||||
|
||||
memset(&elem_id, 0, sizeof(elem_id));
|
||||
elem_id.iface = SNDRV_CTL_ELEM_IFACE_PCM;
|
||||
strcpy(elem_id.name, name);
|
||||
strlcpy(elem_id.name, name, sizeof(elem_id.name));
|
||||
return snd_ctl_find_id(audio_dev->uac->card, &elem_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user