diff options
author | Joshua Colp <jcolp@digium.com> | 2015-08-06 12:05:07 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-08-06 12:05:07 -0500 |
commit | 9182c9e4e60669348b6f5001990fe2ca02a60ab0 (patch) | |
tree | 9977666f339b58ae2d602143c35101d8ece1573f /res/res_rtp_asterisk.c | |
parent | ba40b07ddcd0e060404d3a518974d75f6e0fd80d (diff) | |
parent | 84262749d2a1f59f669e801d5f796b016b223960 (diff) |
Merge "res_rtp_asterisk.c: Fix off-nominal crash potential." into 13
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r-- | res/res_rtp_asterisk.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 462091778..43615d6c8 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -4517,6 +4517,10 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc } payload = ast_rtp_codecs_get_payload(ast_rtp_instance_get_codecs(instance), payloadtype); + if (!payload) { + /* Unknown payload type. */ + return AST_LIST_FIRST(&frames) ? AST_LIST_FIRST(&frames) : &ast_null_frame; + } /* If the payload is not actually an Asterisk one but a special one pass it off to the respective handler */ if (!payload->asterisk_format) { @@ -4543,10 +4547,7 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc /* Even if no frame was returned by one of the above methods, * we may have a frame to return in our frame list */ - if (!AST_LIST_EMPTY(&frames)) { - return AST_LIST_FIRST(&frames); - } - return &ast_null_frame; + return AST_LIST_FIRST(&frames) ? AST_LIST_FIRST(&frames) : &ast_null_frame; } ao2_replace(rtp->lastrxformat, payload->format); |