Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: wavefront: Use safer strscpy() instead of strcpy()

Use a safer function strscpy() instead of strcpy() for copying to
arrays.

Only idiomatic code replacement, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250710100727.22653-38-tiwai@suse.de

+8 -8
+8 -8
sound/isa/wavefront/wavefront.c
··· 234 234 235 235 if (snd_hwdep_new(card, "WaveFront", hw_dev, &wavefront_synth) < 0) 236 236 return NULL; 237 - strcpy (wavefront_synth->name, 237 + strscpy (wavefront_synth->name, 238 238 "WaveFront (ICS2115) wavetable synthesizer"); 239 239 wavefront_synth->ops.open = snd_wavefront_synth_open; 240 240 wavefront_synth->ops.release = snd_wavefront_synth_release; ··· 292 292 return NULL; 293 293 294 294 if (mpu == internal_mpu) { 295 - strcpy(rmidi->name, "WaveFront MIDI (Internal)"); 295 + strscpy(rmidi->name, "WaveFront MIDI (Internal)"); 296 296 rmidi->private_data = &internal_id; 297 297 } else { 298 - strcpy(rmidi->name, "WaveFront MIDI (External)"); 298 + strscpy(rmidi->name, "WaveFront MIDI (External)"); 299 299 rmidi->private_data = &external_id; 300 300 } 301 301 ··· 407 407 return -ENOMEM; 408 408 } 409 409 410 - strcpy (wavefront_synth->name, "ICS2115 Wavetable MIDI Synthesizer"); 410 + strscpy (wavefront_synth->name, "ICS2115 Wavetable MIDI Synthesizer"); 411 411 wavefront_synth->iface = SNDRV_HWDEP_IFACE_ICS2115; 412 412 hw_dev++; 413 413 ··· 478 478 479 479 hw_dev++; 480 480 481 - strcpy(card->driver, "Tropez+"); 482 - strcpy(card->shortname, "Turtle Beach Tropez+"); 481 + strscpy(card->driver, "Tropez+"); 482 + strscpy(card->shortname, "Turtle Beach Tropez+"); 483 483 } else { 484 484 /* Need a way to distinguish between Maui and Tropez */ 485 - strcpy(card->driver, "WaveFront"); 486 - strcpy(card->shortname, "Turtle Beach WaveFront"); 485 + strscpy(card->driver, "WaveFront"); 486 + strscpy(card->shortname, "Turtle Beach WaveFront"); 487 487 } 488 488 489 489 /* ----- Register the card --------- */