]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
sigh
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 23 Oct 2007 01:29:37 +0000 (01:29 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 23 Oct 2007 01:29:37 +0000 (01:29 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6023 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_channel.c

index 6d74328222ef6e7a945a8cf30b8ef8818a7afabf..0a635d550a51c1779f65bf9e202b9166a7d465a1 100644 (file)
@@ -1264,30 +1264,46 @@ if ((dp = realloc(data, olen))) {\
 
 SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel, char *in)
 {
-       char *p, *c;
+       char *q, *p, *c = NULL;
        char *data, *indup;
        size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128;
        char *sub_val = NULL, *func_val = NULL;
        int nv = 0;
 
-       if (in && (p = strchr(in, '$'))) {
-               if (!*(p + 1)) {
-                       return in;
+       q = in;
+       while(q && *q) {
+               if (!(p = strchr(q, '$'))) {
+                       break;
                }
-       } else {
+               
+               if (*(p-1) == '\\') {
+                       q = p + 1;
+                       continue;
+               }
+
+               if (*(p+1) != '{') {
+                       q = p + 1;
+                       continue;
+               }
+               
+               nv = 1;
+               break;
+       }
+       
+       if (!nv) {
                return in;
        }
 
-       
-       olen = strlen(in);
+       nv = 0;
+       olen = strlen(in) + 1;
        indup = strdup(in);
 
        if ((data = malloc(olen))) {
                memset(data, 0, olen);
                c = data;
-               for (p = indup; *p; p++) {
+               for (p = indup; p && *p; p++) {
                        vtype = 0;
-
+                       
                        if (*p == '\\') {
                                if (*(p + 1) == '$') {
                                        nv = 1;