[asterisk-dev] [Code Review]: Continuing from 1643 (Allow specifying which MixMonitor to Stop)

Mark Michelson reviewboard at asterisk.org
Mon Jan 23 09:29:37 CST 2012



> On Jan. 20, 2012, 5:22 p.m., Mark Michelson wrote:
> > /trunk/apps/app_mixmonitor.c, lines 881-886
> > <https://reviewboard.asterisk.org/r/1682/diff/3/?file=23504#file23504line881>
> >
> >     Since the args for the various mixmonitor commands are optional, referencing a->argv[3] may be referencing memory off the end of the argv array. These two commands need to be updated to make sure that argc > 3 before trying to reference argv[3]. Otherwise pass an empty string.
> 
> jrose wrote:
>     Already above this block of code is the following:
>     
>     if (a->argc < 3)
>         return CLI_USAGE;
>     
>     At the moment, there is no command that I'm aware of to stop all mixmonitors on every channel, which is what I would guess would be implied by "mixmonitor stop" without a third argument.
>     
>     Just about ready to post the next diff.

You're misunderstanding the problem here. Understand that since argv is a 0-indexed array, argv[3] is the *fourth* word on the CLI. The check to make sure that argc is not less than three does not ensure that argc is 4 or more. So if someone did a "mixmonitor stop SIP/1000" but did not put any arguments like "bv(-2)" then you'd end up passing potential garbage to stop_mixmonitor_exec(). However, "mixmonitor stop SIP/1000" is a valid command, it just means there are no further arguments.


- Mark


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1682/#review5253
-----------------------------------------------------------


On Jan. 23, 2012, 8:47 a.m., jrose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1682/
> -----------------------------------------------------------
> 
> (Updated Jan. 23, 2012, 8:47 a.m.)
> 
> 
> Review request for Asterisk Developers, Mark Michelson and telecos.
> 
> 
> Summary
> -------
> 
> Fixes style problems from r6 on https://reviewboard.asterisk.org/r/1643/
> Changes creation of character buffer to length of a pointer in characters + 3 (2 for 0x, 1 for terminating space)
> 
> That might not be adequate.  Richard was saying something about pointers on other operating systems having other dividing symbols in them.  Well, at least ':'s.
> 
> In my experiences though, a pointer is usually just something like 0x0123FEDC when printed with %p.
> 
> 
> This addresses bug ASTERISK-19096.
>     https://issues.asterisk.org/jira/browse/ASTERISK-19096
> 
> 
> Diffs
> -----
> 
>   /trunk/CHANGES 351538 
>   /trunk/apps/app_mixmonitor.c 351538 
> 
> Diff: https://reviewboard.asterisk.org/r/1682/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> jrose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120123/46c5ae86/attachment.htm>


More information about the asterisk-dev mailing list