[Asterisk-Dev] Questions Regarding the ast_copy_string() Janitor Project

Luigi Rizzo rizzo at icir.org
Tue Jan 10 10:52:21 MST 2006


On Tue, Jan 10, 2006 at 12:28:02PM -0500, Matt Roth wrote:
> The ast_copy_string() janitor project is defined as follows:
> 
> - Check all ast_copy_string() usage to ensure that buffers are not being 
> unnecessarily zeroed before or after calling it.
> 
> In apps/app_queue.c I found some instances of memset() being used to 
> zero a buffer that is later being passed to ast_copy_string().  It 

it's probably a leftover from previous code when strncpy was used.
Probably safe to remove it.

> I'm also assuming that using memset() to zero an entire struct 
> containing strings that are then passed to ast_copy_string() is outside 
> the case of this janitor project.  Is that correct?

i'd say yes. in this case the memset is a quick way to make sure
the struct is consistently initialized. Many of them should
disappear by replacing malloc() + memset() with calloc() calls.

cheers
luigi



More information about the asterisk-dev mailing list