aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-09-27 02:22:18 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-09-27 02:22:18 +0000
commit464ddce136db0f28a022b97a3bc6be2b58ce1f44 (patch)
tree903b5f5ac558eaba1d154f3f60a30fd943855120 /pbx.c
parentef07eb03fd71abd33c04db48530eaf8fb4175855 (diff)
Move to asprintf (bug #252)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1562 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/pbx.c b/pbx.c
index aa833c791..ba5f8c075 100755
--- a/pbx.c
+++ b/pbx.c
@@ -2336,8 +2336,8 @@ static char *complete_show_application(char *line, char *word,
static int handle_show_application(int fd, int argc, char *argv[])
{
struct ast_app *a;
- char buf[2048];
- int app, no_registered_app = 1;
+ int n, app, no_registered_app = 1;
+ char *buf;
if (argc < 3) return RESULT_SHOWUSAGE;
@@ -2357,14 +2357,17 @@ static int handle_show_application(int fd, int argc, char *argv[])
no_registered_app = 0;
/* ... one of our applications, show info ...*/
- snprintf(buf, sizeof(buf),
+ n = asprintf(&buf,
"\n -= Info about application '%s' =- \n\n"
"[Synopsis]:\n %s\n\n"
"[Description]:\n%s\n",
a->name,
a->synopsis ? a->synopsis : "Not available",
a->description ? a-> description : "Not available");
- ast_cli(fd, buf);
+ if (n >= 0) {
+ ast_cli(fd, buf);
+ free(buf);
+ }
}
}
a = a->next;