aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_chanisavail.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_chanisavail.c')
-rwxr-xr-xapps/app_chanisavail.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c
index 6f60fba15..5c9d4e707 100755
--- a/apps/app_chanisavail.c
+++ b/apps/app_chanisavail.c
@@ -72,16 +72,17 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
int res=-1, inuse=-1, option_state=0;
int status;
struct localuser *u;
- char info[512], tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur, *options, *stringp;
+ char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur, *options, *stringp;
struct ast_channel *tempchan;
- if (!data) {
+ if (!data || ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ChanIsAvail requires an argument (Zap/1&Zap/2)\n");
return -1;
}
+
LOCAL_USER_ADD(u);
- strncpy(info, (char *)data, sizeof(info)-1);
+ info = ast_strdupa(data);
stringp = info;
strsep(&stringp, "|");
options = strsep(&stringp, "|");