aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-07 00:52:17 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-07 00:52:17 +0000
commitc21fac7a2fea7c8433cfdb935a4ebdb1a34ae61e (patch)
treea4a168acf649d40c6569e72b2d1740cfd7b3d074
parent09e8e780bef8abf3fb8c8f34b843b5baf654d2f3 (diff)
At the end of a call, when we're reporting, RTCP may already be partially torn down, so check for NULL dereference
Reported by: blitzrage Patch by: tilghman (Closes issue #11450) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@91637 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/rtp.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/main/rtp.c b/main/rtp.c
index 60341ac9d..4d850cb4b 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -2078,20 +2078,34 @@ char *ast_rtp_get_quality(struct ast_rtp *rtp, struct ast_rtp_quality *qual)
*rtt round trip time
*/
- if (qual) {
+ if (qual && rtp) {
qual->local_ssrc = rtp->ssrc;
- qual->local_lostpackets = rtp->rtcp->expected_prior - rtp->rtcp->received_prior;
qual->local_jitter = rtp->rxjitter;
qual->local_count = rtp->rxcount;
qual->remote_ssrc = rtp->themssrc;
- qual->remote_lostpackets = rtp->rtcp->reported_lost;
- qual->remote_jitter = rtp->rtcp->reported_jitter / 65536.0;
qual->remote_count = rtp->txcount;
- qual->rtt = rtp->rtcp->rtt;
+ if (rtp->rtcp) {
+ qual->local_lostpackets = rtp->rtcp->expected_prior - rtp->rtcp->received_prior;
+ qual->remote_lostpackets = rtp->rtcp->reported_lost;
+ qual->remote_jitter = rtp->rtcp->reported_jitter / 65536.0;
+ qual->rtt = rtp->rtcp->rtt;
+ }
}
- snprintf(rtp->rtcp->quality, sizeof(rtp->rtcp->quality), "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", rtp->ssrc, rtp->themssrc, rtp->rtcp->expected_prior - rtp->rtcp->received_prior, rtp->rxjitter, rtp->rxcount, (double)rtp->rtcp->reported_jitter/65536., rtp->txcount, rtp->rtcp->reported_lost, rtp->rtcp->rtt);
-
- return rtp->rtcp->quality;
+ if (rtp->rtcp) {
+ snprintf(rtp->rtcp->quality, sizeof(rtp->rtcp->quality),
+ "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f",
+ rtp->ssrc,
+ rtp->themssrc,
+ rtp->rtcp->expected_prior - rtp->rtcp->received_prior,
+ rtp->rxjitter,
+ rtp->rxcount,
+ (double)rtp->rtcp->reported_jitter / 65536.0,
+ rtp->txcount,
+ rtp->rtcp->reported_lost,
+ rtp->rtcp->rtt);
+ return rtp->rtcp->quality;
+ } else
+ return "<Unknown> - RTP/RTCP has already been destroyed";
}
void ast_rtp_destroy(struct ast_rtp *rtp)