Skip to content

Commit

Permalink
Use strncpy in some calls for alsa_rawmidi.c
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Oct 6, 2019
1 parent f0400a4 commit 37250ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions linux/alsa/alsa_rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void midi_port_init(const alsa_rawmidi_t *midi, midi_port_t *port, snd_rawmidi_i

port->id = *id;
snprintf(port->dev, sizeof(port->dev), "hw:%d,%d,%d", id->id[0], id->id[1], id->id[3]);
snprintf(port->device_name, sizeof(port->device_name), snd_rawmidi_info_get_name(info));
strncpy(port->device_name, snd_rawmidi_info_get_name(info), sizeof(port->device_name));
name = snd_rawmidi_info_get_subdevice_name(info);
if (!strlen(name))
name = port->device_name;
Expand Down Expand Up @@ -468,7 +468,7 @@ int midi_port_open(alsa_rawmidi_t *midi, midi_port_t *port)

/* Some devices (emu10k1) have subdevs with the same name,
* and we need to generate unique port name for jack */
snprintf(name, sizeof(name), "%s", port->name);
strncpy(name, port->name, sizeof(name));
if (midi_port_open_jack(midi, port, type, name)) {
int num;
num = port->id.id[3] ? port->id.id[3] : port->id.id[1];
Expand Down

0 comments on commit 37250ff

Please sign in to comment.