From 2757a71dac1ea44ceda02f190bff7ff01da645c1 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 23 Sep 2024 20:48:12 +0200 Subject: [PATCH] MT#60476 sdp_create: fix crash on zero stream It's been noticed that trying to print a zero conneciton address, on the media stream, which actually offered non-zeroed IP source, but a zero port, leads to a segmentation fault, because it relies in this case on presented `sockaddr_t` information, which is actually absent. This happens only with sdp_create on offer/answer. Test fixed is "a=mid on zero streams". Change-Id: Ic2f7f671c9ded9b361d6467ca013698fdff28538 --- daemon/sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index e04ef4738..0bfc9db27 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -3688,7 +3688,7 @@ static void sdp_out_add_media_connection(GString *out, struct call_media *media, const char *media_conn_address_type = NULL; /* print zeroed address */ - if (PS_ISSET(rtp_ps, ZERO_ADDR) && !MEDIA_ISSET(media, ICE)) { + if (!address || (PS_ISSET(rtp_ps, ZERO_ADDR) && !MEDIA_ISSET(media, ICE))) { if (!address) { const struct intf_address *ifa_addr; const struct local_intf *ifa;