diff --git a/src/audio/playback/mixer.cpp b/src/audio/playback/mixer.cpp index c178e603f..db026f3ec 100644 --- a/src/audio/playback/mixer.cpp +++ b/src/audio/playback/mixer.cpp @@ -290,7 +290,7 @@ struct state_audio_mixer final { struct socket_udp_local *recv_socket{}; string audio_codec{"PCM"}; sockaddr_storage - only_sender; ///< if !AF_UNSPEC, use stream just from this sender + only_sender{}; ///< if !AF_UNSPEC, use stream just from this sender private: struct module mod; thread thread_id; @@ -330,14 +330,22 @@ state_audio_mixer::check_messages() MSG(INFO, "flushing the address restriction (defaulting to mix all)\n"); only_sender.ss_family = AF_UNSPEC; } else { - MSG(INFO, "restricting mixer to: %s\n", val); - only_sender = get_sockaddr(val, 0); - if (participants.find(only_sender) == - participants.end()) { - MSG(WARNING, - "The requested participant %s is not yet " - "present...\n", - val); + struct sockaddr_storage ss = get_sockaddr(val, 0); + if (ss.ss_family != AF_UNSPEC) { + MSG(INFO, "restricting mixer to: %s\n", val); + only_sender = ss; + if (participants.find(only_sender) == + participants.end()) { + MSG(WARNING, + "The requested participant %s is " + "not yet present...\n", val); + } + } else { + MSG(ERROR, "Wrong addr spec: %s\n", val); + free_message(msg, + new_response(RESPONSE_BAD_REQUEST, + nullptr)); + continue; } } diff --git a/src/utils/net.c b/src/utils/net.c index 96ebd5662..7cbba0442 100644 --- a/src/utils/net.c +++ b/src/utils/net.c @@ -477,11 +477,10 @@ get_sockaddr_str(const struct sockaddr *sa, unsigned sa_len, char *buf, struct sockaddr_storage get_sockaddr(const char *hostport, int mode) { - struct sockaddr_storage ret; + struct sockaddr_storage ret = { .ss_family = AF_UNSPEC }; socklen_t socklen_unused = 0; char host[STR_LEN]; - ret.ss_family = AF_UNSPEC; const char *const rightmost_colon = strrchr(hostport, ':'); if (rightmost_colon == NULL) { MSG(ERROR, "Address %s not in format host:port!\n", hostport);