Skip to content

Commit

Permalink
seq: Avoid strlcat()
Browse files Browse the repository at this point in the history
strlcat() isn't available in every system, so better to avoid it.
Rewrite the code without strlcat().

Fixes: 6167b8c ("seq: Add API helper functions for creating UMP Endpoint and Blocks")
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Jul 31, 2024
1 parent f090a93 commit d969439
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/seq/seqmid.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)
char blknames[64];
char name[64];
unsigned int caps = 0;
int len;

blknames[0] = 0;
for (b = 0; b < ep->num_blocks; b++) {
Expand Down Expand Up @@ -668,14 +669,13 @@ static void update_group_ports(snd_seq_t *seq, snd_ump_endpoint_info_t *ep)

if (!*bp->name)
continue;
if (*blknames) {
strlcat(blknames, ", ", sizeof(blknames));
strlcat(blknames, (const char *)bp->name,
sizeof(blknames));
} else {
len = strlen(blknames);
if (len)
snprintf(blknames + len, sizeof(blknames) - len,
", %s", bp->name);
else
snd_strlcpy(blknames, (const char *)bp->name,
sizeof(blknames));
}
}

if (!*blknames)
Expand Down

0 comments on commit d969439

Please sign in to comment.