[Freeswitch-dev] Substutions in XML dial plan

Anthony Minessale anthony.minessale at gmail.com
Thu Jun 26 16:37:27 EDT 2008


see if latest trunk fixes it.


On Wed, Jun 25, 2008 at 1:16 PM, Simon Perreault <
simon.perreault at viagenie.ca> wrote:

> Hello,
>
> My dial plan contains something like the following:
>
> <action application="bridge" data="sofia/profile1/$1,sofia/profile2/$1"/>
>
> This causes a problem in mod_dialplan_xml.c, near line 150:
>
>                len = (uint32_t) (strlen(data) + strlen(field_data) + 10);
>                if (!(substituted = malloc(len))) {
>                    switch_log_printf(SWITCH_CHANNEL_LOG,
> SWITCH_LOG_CRIT, "memory error!\n");
>                    proceed = 0;
>                    goto done;
>                }
>                memset(substituted, 0, len);
>                switch_perform_substitution(re, proceed, data, field_data,
> substituted, len, ovector);
>                app_data = substituted;
>
> The problem is simple: len is too small because the $1 pattern appears
> twice.
> Therefore adding strlen(field_data) once is not enough. It should be
> multiplied by the number of times the pattern appears in the string.
>
> It seems like someone experienced the same problem before: that would
> explain
> the "+ 10" magic number which I am very tempted to just increase to 100.
> ;-)
>
> Is this really a bug or is it my imagination? If it is a bug, how should we
> go
> about fixing it?
>
> Thanks,
> Simon
>
> --
> Please try Numb, a STUN/TURN server implementation.
> Free access at http://numb.viagenie.ca/.
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20080626/8bbaf903/attachment.html 


More information about the Freeswitch-dev mailing list