neels has uploaded this change for review.

View Change

sdp_msg: when NULL, do not crash but return empty SDP str

Change-Id: Ibd5c43fae61cd006d8fb42a06b99a609356f7037
---
M src/libmsc/sdp_msg.c
1 file changed, 10 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/06/30106/1
diff --git a/src/libmsc/sdp_msg.c b/src/libmsc/sdp_msg.c
index eda6ac9..09e1277 100644
--- a/src/libmsc/sdp_msg.c
+++ b/src/libmsc/sdp_msg.c
@@ -220,8 +220,16 @@
{
const struct sdp_audio_codec *codec;
struct osmo_strbuf sb = { .buf = dst, .len = dst_size };
- const char *ip = sdp->rtp.ip[0] ? sdp->rtp.ip : "0.0.0.0";
- char ipv = osmo_ip_str_type(ip) == AF_INET6 ? '6' : '4';
+ const char *ip;
+ char ipv;
+
+ if (!sdp) {
+ OSMO_STRBUF_PRINTF(sb, "%s", "");
+ return sb.chars_needed;
+ }
+
+ ip = sdp->rtp.ip[0] ? sdp->rtp.ip : "0.0.0.0";
+ ipv = (osmo_ip_str_type(ip) == AF_INET6) ? '6' : '4';

OSMO_STRBUF_PRINTF(sb,
"v=0\r\n"

To view, visit change 30106. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ibd5c43fae61cd006d8fb42a06b99a609356f7037
Gerrit-Change-Number: 30106
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-MessageType: newchange