mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Prevent a crash in chan_local due to a potential NULL pointer dereference
Move the check for if both channels on a local_pvt have generators to below where p->chan is checked for NULLity (NULLness?). This prevents a crash from occurring if p->chan is NULL. (closes issue #14189) Reported by: sascha Patches: 14189.patch uploaded by putnopvut (license 60) Tested by: sascha git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@169210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -168,10 +168,6 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra
|
|||||||
/* Recalculate outbound channel */
|
/* Recalculate outbound channel */
|
||||||
other = isoutbound ? p->owner : p->chan;
|
other = isoutbound ? p->owner : p->chan;
|
||||||
|
|
||||||
/* do not queue frame if generator is on both local channels */
|
|
||||||
if (us && us->generator && other->generator)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Set glare detection */
|
/* Set glare detection */
|
||||||
ast_set_flag(p, LOCAL_GLARE_DETECT);
|
ast_set_flag(p, LOCAL_GLARE_DETECT);
|
||||||
if (ast_test_flag(p, LOCAL_CANCEL_QUEUE)) {
|
if (ast_test_flag(p, LOCAL_CANCEL_QUEUE)) {
|
||||||
@@ -186,6 +182,10 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* do not queue frame if generator is on both local channels */
|
||||||
|
if (us && us->generator && other->generator)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Ensure that we have both channels locked */
|
/* Ensure that we have both channels locked */
|
||||||
while (other && ast_channel_trylock(other)) {
|
while (other && ast_channel_trylock(other)) {
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
Reference in New Issue
Block a user