[asterisk-dev] no ast_channel_varshead in 1.8 [was: Re: [svn-commits] sgriepentrog: branch 1.8 r404674 - /branches/1.8/funcs/func_strings.c]
Scott Griepentrog
sgriepentrog at digium.com
Mon Jan 6 11:36:12 CST 2014
Thanks for catching that. I've updated my build script to set
TEST_FRAMEWORK so I don't miss that in the future. Patched in r404941, and
double checked to insure tests pass.
On Sat, Jan 4, 2014 at 9:46 AM, Tzafrir Cohen <tzafrir.cohen at xorcom.com>wrote:
> On Thu, Jan 02, 2014 at 07:32:24PM -0000, SVN commits to the Digium
> repositories wrote:
> > Author: sgriepentrog
> > Date: Thu Jan 2 13:32:20 2014
> > New Revision: 404674
> >
> > URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404674
> > Log:
> > func_strings: use memmove to prevent overlapping memory on strcpy
> >
> > When calling REPLACE() with an empty replace-char argument, strcpy
> > is used to overwrite the the matching <find-char>. However as the
> > src and dest arguments to strcpy must not overlap, it causes other
> > parts of the string to be overwritten with adjacent characters and
> > the result is mangled. Patch replaces call to strcpy with memmove
> > and adds a test suite case for REPLACE.
> >
> > (closes issue ASTERISK-22910)
> > Reported by: Gareth Palmer
> > Patches:
> > func_strings.patch uploaded by Gareth Palmer (license 5169)
> >
> >
> > Modified:
> > branches/1.8/funcs/func_strings.c
> >
> > Modified: branches/1.8/funcs/func_strings.c
> > URL:
> http://svnview.digium.com/svn/asterisk/branches/1.8/funcs/func_strings.c?view=diff&rev=404674&r1=404673&r2=404674
> >
> ==============================================================================
> > --- branches/1.8/funcs/func_strings.c (original)
> > +++ branches/1.8/funcs/func_strings.c Thu Jan 2 13:32:20 2014
> [snip]
>
> > * directly there */
> > if (strchr(find, *strptr)) {
> > if (ast_strlen_zero(replace)) {
> > - /* Remove character */
> > - strcpy(strptr, strptr + 1); /* SAFE */
> > + memmove(strptr, strptr + 1, strlen(strptr
> + 1) + 1);
> > strptr--;
> > } else {
> > /* Replace character */
> > @@ -1619,6 +1618,76 @@
> > return res;
> > }
> >
> > +AST_TEST_DEFINE(test_REPLACE)
>
> [snip]
>
> > + }
> > +
> > + AST_LIST_INSERT_HEAD(ast_channel_varshead(chan), var,
> entries);
>
> ast_channel_varshead does not exist in 1.8. This fails the builds.
>
> s/ast_channel_varshead(chan)/&chan->varshead/ ?
>
> http://svn.asterisk.org/svn/asterisk/trunk@357542
>
> > +
> > + snprintf(expression, sizeof(expression),
> "${REPLACE(%s,%s,%s)}", var->name, test_args[i].find_chars,
> test_args[i].replace_char);
> > + ast_str_substitute_variables(&str, 0, chan, expression);
> > +
> > + AST_LIST_REMOVE(ast_channel_varshead(chan), var, entries);
>
> likewise.
>
> --
> Tzafrir Cohen
> icq#16849755 jabber:tzafrir.cohen at xorcom.com
> +972-50-7952406 mailto:tzafrir.cohen at xorcom.com
> http://www.xorcom.com
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
--
[image: Digium logo]
*Scott Griepentrog*
Digium, Inc · Software Developer
445 Jan Davis Drive NW · Huntsville, AL 35806 · US
direct/fax: +1 256 428 6239 · mobile: +1 317 507 4029
Check us out at: http://digium.com <http://www.digium.com> ·
http://asterisk.org <http://www.asterisk.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140106/a84ade97/attachment.html>
More information about the asterisk-dev
mailing list