diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-01 23:53:12 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-01 23:53:12 +0000 |
commit | fd899f06543c87b9e8acc50faff01a5818cbc6b5 (patch) | |
tree | 3ebe9235f95a3e5f80ee3969797e81aa3ee5468e /main/rtp.c | |
parent | 98207b7cdc24e4951fd6fe5e328c5f810033f9ee (diff) |
Fix a bunch of off-by-one errors
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@221776 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r-- | main/rtp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main/rtp.c b/main/rtp.c index 770292a4f..519ecf35c 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -1696,7 +1696,7 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i */ void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt) { - if (pt < 0 || pt > MAX_RTP_PT || static_RTP_PT[pt].code == 0) + if (pt < 0 || pt >= MAX_RTP_PT || static_RTP_PT[pt].code == 0) return; /* bogus payload type */ ast_mutex_lock(&rtp->bridge_lock); @@ -1708,7 +1708,7 @@ void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt) an unknown media type */ void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt) { - if (pt < 0 || pt > MAX_RTP_PT) + if (pt < 0 || pt >= MAX_RTP_PT) return; /* bogus payload type */ ast_mutex_lock(&rtp->bridge_lock); @@ -1728,7 +1728,7 @@ int ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt, unsigned int i; int found = 0; - if (pt < 0 || pt > MAX_RTP_PT) + if (pt < 0 || pt >= MAX_RTP_PT) return -1; /* bogus payload type */ ast_mutex_lock(&rtp->bridge_lock); @@ -1780,7 +1780,7 @@ struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt) result.isAstFormat = result.code = 0; - if (pt < 0 || pt > MAX_RTP_PT) + if (pt < 0 || pt >= MAX_RTP_PT) return result; /* bogus payload type */ /* Start with negotiated codecs */ @@ -2846,7 +2846,7 @@ struct ast_codec_pref *ast_rtp_codec_getpref(struct ast_rtp *rtp) int ast_rtp_codec_getformat(int pt) { - if (pt < 0 || pt > MAX_RTP_PT) + if (pt < 0 || pt >= MAX_RTP_PT) return 0; /* bogus payload type */ if (static_RTP_PT[pt].isAstFormat) |