]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a place where a chan_iax2 pvt struct was accessed without the lock held.
authorRussell Bryant <russell@russellbryant.com>
Wed, 13 Jun 2007 16:29:12 +0000 (16:29 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 13 Jun 2007 16:29:12 +0000 (16:29 +0000)
This issue was reported to me via email by Dmitry Mishchenko.  Thanks!

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@69069 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index c94a6dac6720a490dff2d83b79109a528b6b806d..527b48977226cf8b3664272a5f1c3b85a57c2b52 100644 (file)
@@ -6904,11 +6904,18 @@ retryowner:
                                                ast_log(LOG_NOTICE, "Rejected connect attempt from %s, who was trying to reach '%s@%s'\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->exten, iaxs[fr->callno]->context);
                                        break;
                                }
-                               /* This might re-enter the IAX code and need the lock */
                                if (strcasecmp(iaxs[fr->callno]->exten, "TBD")) {
+                                       const char *context, *exten, *cid_num;
+
+                                       context = ast_strdupa(iaxs[fr->callno]->context);
+                                       exten = ast_strdupa(iaxs[fr->callno]->exten);
+                                       cid_num = ast_strdupa(iaxs[fr->callno]->cid_num);
+
+                                       /* This might re-enter the IAX code and need the lock */
                                        ast_mutex_unlock(&iaxsl[fr->callno]);
-                                       exists = ast_exists_extension(NULL, iaxs[fr->callno]->context, iaxs[fr->callno]->exten, 1, iaxs[fr->callno]->cid_num);
+                                       exists = ast_exists_extension(NULL, context, exten, 1, cid_num);
                                        ast_mutex_lock(&iaxsl[fr->callno]);
+
                                        if (!iaxs[fr->callno]) {
                                                ast_mutex_unlock(&iaxsl[fr->callno]);
                                                return 1;