[Asterisk-Dev] [bug] sizeof buf in pbx.c:handle_show_application() is to small

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Oct 17 14:29:43 MST 2003


On Friday 17 October 2003 15:17, Steven Critchfield wrote:
> While looking up documentation for a person on the user list, I
> noticed the show application dial command didn't return all of the
> help file. So far it looks like everything uses a pointer to the
> data with the exception of handle_show_application in pbx.c. In
> this function a sprintf is used to fill buff[2048] with formated
> information. In the case of Dial, This string has just recently
> crossed over the 2k buf.
>
> As this may affect other applications, I do not want to submit a
> patch myself that just bumps the size of buff without further
> looking into this problem. But if someone who knows more looks it
> over before me, then fine.

I'm not sure where you're seeing this.  I'm looking at that function
and it's doing an asprintf, which allocates all the memory it needs.

What could be a problem, though, is cli.c:  ast_cli() uses a static
buffer of 4096.  Actually, now that I'm looking at this, it appears
that handle_show_application() does an asprintf, then ast_cli() does
a vsnprintf, which is unnecessary reprocessing, to say the least.

-Tilghman




More information about the asterisk-dev mailing list