acp: improve debug of channel map

Increase the size of the channel_map debug printf buffer.
Use a safer version of the snprintf that avoids buffer overruns.

See #1781
This commit is contained in:
Wim Taymans 2021-11-04 16:41:32 +01:00
parent efd8ac25e3
commit 86ca0f8466
3 changed files with 41 additions and 4 deletions

View file

@ -224,7 +224,7 @@ static char* channel_map_snprint(char *s, size_t l, const struct channel_map *ma
*(e = s) = 0;
for (channel = 0; channel < map->channels && l > 1; channel++) {
l -= snprintf(e, l, "%s%s",
l -= spa_scnprintf(e, l, "%s%s",
first ? "" : ",",
channel_id2paname(map->map[channel], &aux));
@ -381,7 +381,7 @@ static void service_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupStat
}
}
#define PA_CHANNEL_MAP_SNPRINT_MAX 336
#define PA_CHANNEL_MAP_SNPRINT_MAX (CHANNELS_MAX * 32)
static void publish_service(struct service *s)
{