]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 305253 via svnmerge from
authorJason Parker <jparker@digium.com>
Mon, 31 Jan 2011 23:07:00 +0000 (23:07 +0000)
committerJason Parker <jparker@digium.com>
Mon, 31 Jan 2011 23:07:00 +0000 (23:07 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
  r305253 | qwell | 2011-01-31 16:59:34 -0600 (Mon, 31 Jan 2011) | 17 lines

  Merged revisions 305252 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r305252 | qwell | 2011-01-31 16:56:54 -0600 (Mon, 31 Jan 2011) | 10 lines

    Prevent a crash when dialing a technology with no destination (ex: Dial(SIP/))

    chan_iax2 and other channel drivers already had code to prevent this.  The
    attempt that app_dial was making to prevent it was not correct, so I fixed that.

    (closes issue #18371)
    Reported by: gbour
    Patches:
          18371.patch uploaded by gbour (license 1162)
  ........
................

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

apps/app_dial.c
channels/chan_sip.c

index a1522a81a05268851bd9925dcee464670a21b408..581a881701ae9138e77a83a308ba74570e08e1a9 100644 (file)
@@ -1944,7 +1944,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
                struct ast_dialed_interface *di;
                AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces;
                num_dialed++;
-               if (!number) {
+               if (ast_strlen_zero(number)) {
                        ast_log(LOG_WARNING, "Dial argument takes format (technology/[device:]number1)\n");
                        goto out;
                }
index d41ef2109c4d3b2824c782cdc72a2cb4f1f18584..7da26096398c6cb34c98962d7234ad1bb37819c9 100644 (file)
@@ -25142,6 +25142,12 @@ static struct ast_channel *sip_request_call(const char *type, format_t format, c
        }
        ast_debug(1, "Asked to create a SIP channel with formats: %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), oldformat));
 
+       if (ast_strlen_zero(dest)) {
+               ast_log(LOG_ERROR, "Unable to create channel with empty destination.\n");
+               *cause = AST_CAUSE_CHANNEL_UNACCEPTABLE;
+               return NULL;
+       }
+
        if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE, NULL))) {
                ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", dest);
                *cause = AST_CAUSE_SWITCH_CONGESTION;