--- src/modules/macosx/module-coreaudio-device.c.orig 2024-01-12 11:22:09.000000000 -0600 +++ src/modules/macosx/module-coreaudio-device.c 2024-02-09 10:23:22.000000000 -0600 @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -454,7 +455,12 @@ tmp = NULL; } - ca_sink->name = pa_strbuf_to_string_free(strbuf); + /* Clamp to PA_NAME_MAX and leave a "safety margin" for deduplication + * and other appended data. */ + tmp = pa_strbuf_to_string_free(strbuf); + ca_sink->name = pa_xstrndup(tmp, PA_NAME_MAX - 20); + pa_xfree(tmp); + tmp = NULL; pa_log_debug("Stream name is >%s<", ca_sink->name); @@ -588,7 +594,12 @@ tmp = NULL; } - ca_source->name = pa_strbuf_to_string_free(strbuf); + /* Clamp to PA_NAME_MAX and leave a "safety margin" for deduplication + * and other appended data. */ + tmp = pa_strbuf_to_string_free(strbuf); + ca_source->name = pa_xstrndup(tmp, PA_NAME_MAX - 20); + pa_xfree(tmp); + tmp = NULL; pa_log_debug("Stream name is >%s<", ca_source->name);