aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-25 17:12:25 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-25 17:12:25 +0000
commit4f4ebd1094f1ea8cd932338bae226dd433dc7c1b (patch)
tree9e716f5eacd493c95085e3acf05a686e80f16ea5 /channels/chan_sip.c
parent6cd304fbb89b6c12210309e44b2b7c871b16c431 (diff)
Fix potential crashes from trying to reference nonexistent RTP streams.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@254542 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 31c910a88..0c946cf73 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -20957,19 +20957,26 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char
ast_copy_string(buf, (p->t38.state == T38_DISABLED) ? "0" : "1", buflen);
} else if (!strcasecmp(args.param, "rtpdest")) {
struct sockaddr_in sin;
+ struct ast_rtp *stream;
if (ast_strlen_zero(args.type))
args.type = "audio";
- if (!strcasecmp(args.type, "audio"))
- ast_rtp_get_peer(p->rtp, &sin);
- else if (!strcasecmp(args.type, "video"))
- ast_rtp_get_peer(p->vrtp, &sin);
- else if (!strcasecmp(args.type, "text"))
- ast_rtp_get_peer(p->trtp, &sin);
- else
+ if (!strcasecmp(args.type, "audio")) {
+ stream = p->rtp;
+ } else if (!strcasecmp(args.type, "video")) {
+ stream = p->vrtp;
+ } else if (!strcasecmp(args.type, "text")) {
+ stream = p->trtp;
+ } else {
+ return -1;
+ }
+
+ if (!stream) {
return -1;
+ }
+ ast_rtp_get_peer(stream, &sin);
snprintf(buf, buflen, "%s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
} else if (!strcasecmp(args.param, "rtpqos")) {
struct ast_rtp_quality qos;