aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-10 23:12:25 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-10 23:12:25 +0000
commitd99da55a16b32f4463c40d504fa2ffee4ba8966d (patch)
treea725ca8f608e13f6dda4ebce3d55d8abafb9317a
parent9690f518f5b644b670f4e8e047083535c106dafa (diff)
more ast_copy_string conversions
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6074 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_adsiprog.c14
-rwxr-xr-xapps/app_alarmreceiver.c16
-rwxr-xr-xapps/app_directory.c14
-rwxr-xr-xapps/app_macro.c14
-rwxr-xr-xapps/app_math.c22
-rwxr-xr-xapps/app_setcallerid.c2
-rwxr-xr-xapps/app_setcidname.c2
-rwxr-xr-xapps/app_setcidnum.c2
-rwxr-xr-xapps/app_setrdnis.c2
-rwxr-xr-xapps/app_settransfercapability.c2
-rwxr-xr-xapps/app_sms.c16
-rwxr-xr-xapps/app_talkdetect.c4
-rwxr-xr-xapps/app_txtcidname.c4
-rwxr-xr-xapps/app_zapras.c2
-rwxr-xr-xapps/app_zapscan.c2
15 files changed, 59 insertions, 59 deletions
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c
index 2dee63fdd..b9d3c096e 100755
--- a/apps/app_adsiprog.c
+++ b/apps/app_adsiprog.c
@@ -402,7 +402,7 @@ static struct adsi_flag *getflagbyname(struct adsi_script *state, char *name, ch
ast_log(LOG_WARNING, "No more flag space at line %d of %s\n", lineno, script);
return NULL;
}
- strncpy(state->flags[state->numflags].vname, name, sizeof(state->flags[state->numflags].vname) - 1);
+ ast_copy_string(state->flags[state->numflags].vname, name, sizeof(state->flags[state->numflags].vname));
state->flags[state->numflags].id = state->numflags + 1;
state->numflags++;
return &state->flags[state->numflags-1];
@@ -505,7 +505,7 @@ static struct adsi_soft_key *getkeybyname(struct adsi_script *state, char *name,
ast_log(LOG_WARNING, "No more key space at line %d of %s\n", lineno, script);
return NULL;
}
- strncpy(state->keys[state->numkeys].vname, name, sizeof(state->keys[state->numkeys].vname) - 1);
+ ast_copy_string(state->keys[state->numkeys].vname, name, sizeof(state->keys[state->numkeys].vname));
state->keys[state->numkeys].id = state->numkeys + 2;
state->numkeys++;
return &state->keys[state->numkeys-1];
@@ -521,7 +521,7 @@ static struct adsi_subscript *getsubbyname(struct adsi_script *state, char *name
ast_log(LOG_WARNING, "No more subscript space at line %d of %s\n", lineno, script);
return NULL;
}
- strncpy(state->subs[state->numsubs].vname, name, sizeof(state->subs[state->numsubs].vname) - 1);
+ ast_copy_string(state->subs[state->numsubs].vname, name, sizeof(state->subs[state->numsubs].vname));
state->subs[state->numsubs].id = state->numsubs;
state->numsubs++;
return &state->subs[state->numsubs-1];
@@ -540,7 +540,7 @@ static struct adsi_state *getstatebyname(struct adsi_script *state, char *name,
ast_log(LOG_WARNING, "No more state space at line %d of %s\n", lineno, script);
return NULL;
}
- strncpy(state->states[state->numstates].vname, name, sizeof(state->states[state->numstates].vname) - 1);
+ ast_copy_string(state->states[state->numstates].vname, name, sizeof(state->states[state->numstates].vname));
state->states[state->numstates].id = state->numstates + 1;
state->numstates++;
return &state->states[state->numstates-1];
@@ -559,7 +559,7 @@ static struct adsi_display *getdisplaybyname(struct adsi_script *state, char *na
ast_log(LOG_WARNING, "No more display space at line %d of %s\n", lineno, script);
return NULL;
}
- strncpy(state->displays[state->numdisplays].vname, name, sizeof(state->displays[state->numdisplays].vname) - 1);
+ ast_copy_string(state->displays[state->numdisplays].vname, name, sizeof(state->displays[state->numdisplays].vname));
state->displays[state->numdisplays].id = state->numdisplays + 1;
state->numdisplays++;
return &state->displays[state->numdisplays-1];
@@ -1045,7 +1045,7 @@ static int adsi_process(struct adsi_script *state, char *buf, char *script, int
break;
}
} else {
- strncpy(tmp2, tmp, sizeof(tmp2) - 1);
+ ast_copy_string(tmp2, tmp, sizeof(tmp2));
}
if (strlen(tmp2) > 18) {
ast_log(LOG_WARNING, "Truncating full name to 18 characters at line %d of %s\n", lineno, script);
@@ -1338,7 +1338,7 @@ static struct adsi_script *compile_script(char *script)
int x, err;
struct adsi_script *scr;
if (script[0] == '/')
- strncpy(fn, script, sizeof(fn) - 1);
+ ast_copy_string(fn, script, sizeof(fn));
else
snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, script);
f = fopen(fn, "r");
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index bdf264ea5..a0788e1c1 100755
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -310,7 +310,7 @@ static int write_metadata( FILE *logfile, char *signalling_type, struct ast_chan
/* Extract the caller ID location */
if (chan->cid.cid_num)
- strncpy(workstring, chan->cid.cid_num, sizeof(workstring) - 1);
+ ast_copy_string(workstring, chan->cid.cid_num, sizeof(workstring));
workstring[sizeof(workstring) - 1] = '\0';
ast_callerid_parse(workstring, &cn, &cl);
@@ -389,7 +389,7 @@ static int log_events(struct ast_channel *chan, char *signalling_type, event_no
/* Make a template */
- strncpy(workstring, event_spool_dir, sizeof(workstring) - 1);
+ ast_copy_string(workstring, event_spool_dir, sizeof(workstring));
strncat(workstring, event_file, sizeof(workstring) - strlen(workstring) - 1);
/* Make the temporary file */
@@ -581,7 +581,7 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int
memset(enew, 0, sizeof(event_node_t));
enew->next = NULL;
- strncpy(enew->data, event, sizeof(enew->data) - 1);
+ ast_copy_string(enew->data, event, sizeof(enew->data));
/*
* Insert event onto end of list
@@ -654,7 +654,7 @@ static int alarmreceiver_exec(struct ast_channel *chan, void *data)
/* Set default values for this invokation of the application */
- strncpy(signalling_type, ADEMCO_CONTACT_ID, sizeof(signalling_type) - 1);
+ ast_copy_string(signalling_type, ADEMCO_CONTACT_ID, sizeof(signalling_type));
/* Answer the channel if it is not already */
@@ -751,7 +751,7 @@ static int load_config(void)
p = ast_variable_retrieve(cfg, "general", "eventcmd");
if(p){
- strncpy(event_app, p, sizeof(event_app) - 1);
+ ast_copy_string(event_app, p, sizeof(event_app));
event_app[sizeof(event_app) - 1] = '\0';
}
@@ -791,21 +791,21 @@ static int load_config(void)
p = ast_variable_retrieve(cfg, "general", "eventspooldir");
if(p){
- strncpy(event_spool_dir, p, sizeof(event_spool_dir) - 1);
+ ast_copy_string(event_spool_dir, p, sizeof(event_spool_dir));
event_spool_dir[sizeof(event_spool_dir) - 1] = '\0';
}
p = ast_variable_retrieve(cfg, "general", "timestampformat");
if(p){
- strncpy(time_stamp_format, p, sizeof(time_stamp_format) - 1);
+ ast_copy_string(time_stamp_format, p, sizeof(time_stamp_format));
time_stamp_format[sizeof(time_stamp_format) - 1] = '\0';
}
p = ast_variable_retrieve(cfg, "general", "db-family");
if(p){
- strncpy(db_family, p, sizeof(db_family) - 1);
+ ast_copy_string(db_family, p, sizeof(db_family));
db_family[sizeof(db_family) - 1] = '\0';
}
ast_config_destroy(cfg);
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 1e451ee2e..252b43787 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -183,9 +183,9 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dia
/* Name selected */
loop = 0;
if (ast_exists_extension(chan,dialcontext,ext,1,chan->cid.cid_num)) {
- strncpy(chan->exten, ext, sizeof(chan->exten)-1);
+ ast_copy_string(chan->exten, ext, sizeof(chan->exten));
chan->priority = 0;
- strncpy(chan->context, dialcontext, sizeof(chan->context)-1);
+ ast_copy_string(chan->context, dialcontext, sizeof(chan->context));
} else {
ast_log(LOG_WARNING,
"Can't find extension '%s' in context '%s'. "
@@ -296,7 +296,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
if (ast_exists_extension(chan,chan->context,"o",1,chan->cid.cid_num) ||
(!ast_strlen_zero(chan->macrocontext) &&
ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num))) {
- strncpy(chan->exten, "o", sizeof(chan->exten)-1);
+ strcpy(chan->exten, "o");
chan->priority = 0;
return 0;
} else {
@@ -310,7 +310,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
if (ast_exists_extension(chan,chan->context,"a",1,chan->cid.cid_num) ||
(!ast_strlen_zero(chan->macrocontext) &&
ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num))) {
- strncpy(chan->exten, "a", sizeof(chan->exten)-1);
+ strcpy(chan->exten, "a");
chan->priority = 0;
return 0;
} else {
@@ -337,7 +337,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
strsep(&stringp, ",");
pos = strsep(&stringp, ",");
if (pos) {
- strncpy(name, pos, sizeof(name) - 1);
+ ast_copy_string(name, pos, sizeof(name));
/* Grab the last name */
if (last && strrchr(pos,' '))
pos = strrchr(pos, ' ') + 1;
@@ -371,8 +371,8 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
case '1':
/* user pressed '1' and extensions exists */
lastuserchoice = res;
- strncpy(chan->context, dialcontext, sizeof(chan->context) - 1);
- strncpy(chan->exten, v->name, sizeof(chan->exten) - 1);
+ ast_copy_string(chan->context, dialcontext, sizeof(chan->context));
+ ast_copy_string(chan->exten, v->name, sizeof(chan->exten));
chan->priority = 0;
break;
case '*':
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 25d2aa864..fb48edc21 100755
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -124,11 +124,11 @@ static int macro_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
/* Save old info */
oldpriority = chan->priority;
- strncpy(oldexten, chan->exten, sizeof(oldexten) - 1);
- strncpy(oldcontext, chan->context, sizeof(oldcontext) - 1);
+ ast_copy_string(oldexten, chan->exten, sizeof(oldexten));
+ ast_copy_string(oldcontext, chan->context, sizeof(oldcontext));
if (ast_strlen_zero(chan->macrocontext)) {
- strncpy(chan->macrocontext, chan->context, sizeof(chan->macrocontext) - 1);
- strncpy(chan->macroexten, chan->exten, sizeof(chan->macroexten) - 1);
+ ast_copy_string(chan->macrocontext, chan->context, sizeof(chan->macrocontext));
+ ast_copy_string(chan->macroexten, chan->exten, sizeof(chan->macroexten));
chan->macropriority = chan->priority;
setmacrocontext=1;
}
@@ -158,7 +158,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
/* Setup environment for new run */
chan->exten[0] = 's';
chan->exten[1] = '\0';
- strncpy(chan->context, fullmacro, sizeof(chan->context) - 1);
+ ast_copy_string(chan->context, fullmacro, sizeof(chan->context));
chan->priority = 1;
while((cur = strsep(&rest, "|")) && (argc < MAX_ARGS)) {
@@ -246,10 +246,10 @@ static int macro_exec(struct ast_channel *chan, void *data)
if (!strcasecmp(chan->context, fullmacro)) {
/* If we're leaving the macro normally, restore original information */
chan->priority = oldpriority;
- strncpy(chan->context, oldcontext, sizeof(chan->context) - 1);
+ ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
/* Copy the extension, so long as we're not in softhangup, where we could be given an asyncgoto */
- strncpy(chan->exten, oldexten, sizeof(chan->exten) - 1);
+ ast_copy_string(chan->exten, oldexten, sizeof(chan->exten));
if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
normally if there is any problem */
diff --git a/apps/app_math.c b/apps/app_math.c
index 630d17b5d..e66341e1d 100755
--- a/apps/app_math.c
+++ b/apps/app_math.c
@@ -1,7 +1,7 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
- * simple maths application
+ * simple math application
*
* Copyright (C) 2004 - 2005, Andy Powell
*
@@ -199,33 +199,33 @@ static int math_exec(struct ast_channel *chan, void *data)
}
case GTFUNCTION :
if (fnum1 > fnum2)
- strncpy (user_result, "TRUE", sizeof (user_result) - 1);
+ strcpy(user_result, "TRUE");
else
- strncpy (user_result, "FALSE", sizeof (user_result) - 1);
+ strcpy(user_result, "FALSE");
break;
case LTFUNCTION :
if (fnum1 < fnum2)
- strncpy (user_result, "TRUE", sizeof (user_result) - 1);
+ strcpy(user_result, "TRUE");
else
- strncpy (user_result, "FALSE", sizeof (user_result) - 1);
+ strcpy(user_result, "FALSE");
break;
case GTEFUNCTION :
if (fnum1 >= fnum2)
- strncpy (user_result, "TRUE", sizeof (user_result) - 1);
+ strcpy(user_result, "TRUE");
else
- strncpy (user_result, "FALSE", sizeof (user_result) - 1);
+ strcpy(user_result, "FALSE");
break;
case LTEFUNCTION :
if (fnum1 <= fnum2)
- strncpy (user_result, "TRUE", sizeof (user_result) - 1);
+ strcpy(user_result, "TRUE");
else
- strncpy (user_result, "FALSE", sizeof (user_result) - 1);
+ strcpy(user_result, "FALSE");
break;
case EQFUNCTION :
if (fnum1 == fnum2)
- strncpy (user_result, "TRUE", sizeof (user_result) - 1);
+ strcpy(user_result, "TRUE");
else
- strncpy (user_result, "FALSE", sizeof (user_result) - 1);
+ strcpy(user_result, "FALSE");
break;
default :
ast_log(LOG_WARNING, "Something happened that neither of us should be proud of %d\n", iaction);
diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c
index 68e9653bd..5104502ca 100755
--- a/apps/app_setcallerid.c
+++ b/apps/app_setcallerid.c
@@ -93,7 +93,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
char *opt;
int anitoo = 0;
if (data)
- strncpy(tmp, (char *)data, sizeof(tmp) - 1);
+ ast_copy_string(tmp, (char *)data, sizeof(tmp));
opt = strchr(tmp, '|');
if (opt) {
*opt = '\0';
diff --git a/apps/app_setcidname.c b/apps/app_setcidname.c
index 20cb23e3f..4126942af 100755
--- a/apps/app_setcidname.c
+++ b/apps/app_setcidname.c
@@ -61,7 +61,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
}
if (data)
- strncpy(tmp, (char *)data, sizeof(tmp) - 1);
+ ast_copy_string(tmp, (char *)data, sizeof(tmp));
opt = strchr(tmp, '|');
if (opt) {
*opt = '\0';
diff --git a/apps/app_setcidnum.c b/apps/app_setcidnum.c
index 516997943..befa9ce6d 100755
--- a/apps/app_setcidnum.c
+++ b/apps/app_setcidnum.c
@@ -63,7 +63,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
}
if (data)
- strncpy(tmp, (char *)data, sizeof(tmp) - 1);
+ ast_copy_string(tmp, (char *)data, sizeof(tmp));
opt = strchr(tmp, '|');
if (opt) {
*opt = '\0';
diff --git a/apps/app_setrdnis.c b/apps/app_setrdnis.c
index 542f03998..44adf1abb 100755
--- a/apps/app_setrdnis.c
+++ b/apps/app_setrdnis.c
@@ -59,7 +59,7 @@ static int setrdnis_exec(struct ast_channel *chan, void *data)
}
if (data)
- strncpy(tmp, (char *)data, sizeof(tmp) - 1);
+ ast_copy_string(tmp, (char *)data, sizeof(tmp));
else
tmp[0] = '\0';
opt = strchr(tmp, '|');
diff --git a/apps/app_settransfercapability.c b/apps/app_settransfercapability.c
index d9c6dc5f8..1242415c4 100755
--- a/apps/app_settransfercapability.c
+++ b/apps/app_settransfercapability.c
@@ -66,7 +66,7 @@ static int settransfercapability_exec(struct ast_channel *chan, void *data)
int transfercapability = -1;
if (data)
- strncpy(tmp, (char *)data, sizeof(tmp) - 1);
+ ast_copy_string(tmp, (char *)data, sizeof(tmp));
opts = strchr(tmp, '|');
if (opts)
*opts = '\0';
diff --git a/apps/app_sms.c b/apps/app_sms.c
index 8c2c43018..c2ffa4a09 100755
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -848,11 +848,11 @@ static void sms_writefile (sms_t * h)
{
char fn[200] = "", fn2[200] = "";
FILE *o;
- strncpy (fn, spool_dir, sizeof (fn) - 1);
+ ast_copy_string (fn, spool_dir, sizeof (fn));
mkdir (fn, 0777); /* ensure it exists */
snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/%s", h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx");
mkdir (fn, 0777); /* ensure it exists */
- strncpy (fn2, fn, sizeof (fn2) - 1);
+ ast_copy_string (fn2, fn, sizeof (fn2));
snprintf (fn2 + strlen (fn2), sizeof (fn2) - strlen (fn2), "/%s.%s-%d", h->queue, isodate (h->scts), seq++);
snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/.%s", fn2 + strlen (fn) + 1);
o = fopen (fn, "w");
@@ -951,7 +951,7 @@ static unsigned char sms_handleincoming (sms_t * h)
h->srr = ((h->imsg[2] & 0x20) ? 1 : 0);
h->udhi = ((h->imsg[2] & 0x40) ? 1 : 0);
h->rp = ((h->imsg[2] & 0x80) ? 1 : 0);
- strncpy (h->oa, h->cli, sizeof (h->oa) - 1);
+ ast_copy_string (h->oa, h->cli, sizeof (h->oa));
h->scts = time (0);
h->mr = h->imsg[p++];
p += unpackaddress (h->da, h->imsg + p);
@@ -1018,7 +1018,7 @@ static void sms_nextoutgoing (sms_t * h)
char fn[100 + NAME_MAX] = "";
DIR *d;
char more = 0;
- strncpy (fn, spool_dir, sizeof (fn) - 1);
+ ast_copy_string (fn, spool_dir, sizeof (fn));
mkdir (fn, 0777); /* ensure it exists */
h->rx = 0; /* outgoing message */
snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/%s", h->smsc ? "mttx" : "motx");
@@ -1360,7 +1360,7 @@ static int sms_exec (struct ast_channel *chan, void *data)
}
if (chan->cid.cid_num)
- strncpy (h.cli, chan->cid.cid_num, sizeof (h.cli) - 1);
+ ast_copy_string (h.cli, chan->cid.cid_num, sizeof (h.cli));
{
unsigned char *d = data,
@@ -1422,12 +1422,12 @@ static int sms_exec (struct ast_channel *chan, void *data)
return 0;
}
if (h.smsc) {
- strncpy (h.oa, d, sizeof (h.oa) - 1);
+ ast_copy_string (h.oa, d, sizeof (h.oa));
} else {
- strncpy (h.da, d, sizeof (h.da) - 1);
+ ast_copy_string (h.da, d, sizeof (h.da));
}
if (!h.smsc)
- strncpy (h.oa, h.cli, sizeof (h.oa) - 1);
+ ast_copy_string (h.oa, h.cli, sizeof (h.oa));
d = p;
h.udl = 0;
while (*p && h.udl < SMSLEN)
diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c
index 52aaa7839..117b835bd 100755
--- a/apps/app_talkdetect.c
+++ b/apps/app_talkdetect.c
@@ -70,7 +70,7 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "BackgroundDetect requires an argument (filename)\n");
return -1;
}
- strncpy(tmp, (char *)data, sizeof(tmp)-1);
+ ast_copy_string(tmp, (char *)data, sizeof(tmp));
stringp=tmp;
strsep(&stringp, "|");
options = strsep(&stringp, "|");
@@ -158,7 +158,7 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
pbx_builtin_setvar_helper(chan, "TALK_DETECTED", ms_str);
if (ast_exists_extension(chan, chan->context, "talk", 1, chan->cid.cid_num)) {
- strncpy(chan->exten, "talk", sizeof(chan->exten) -1 );
+ ast_copy_string(chan->exten, "talk", sizeof(chan->exten));
chan->priority = 0;
}
res = 0;
diff --git a/apps/app_txtcidname.c b/apps/app_txtcidname.c
index 0a2e430c2..d018cbd92 100755
--- a/apps/app_txtcidname.c
+++ b/apps/app_txtcidname.c
@@ -95,9 +95,9 @@ static int load_config(void)
cfg = ast_config_load(ENUM_CONFIG);
if (cfg) {
if (!(s=ast_variable_retrieve(cfg, "general", "h323driver"))) {
- strncpy(h323driver, H323DRIVERDEFAULT, sizeof(h323driver) - 1);
+ ast_copy_string(h323driver, H323DRIVERDEFAULT, sizeof(h323driver));
} else {
- strncpy(h323driver, s, sizeof(h323driver) - 1);
+ ast_copy_string(h323driver, s, sizeof(h323driver));
}
ast_config_destroy(cfg);
return 0;
diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index faed71565..b32596341 100755
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -193,7 +193,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
if (!data)
data = "";
LOCAL_USER_ADD(u);
- strncpy(args, data, sizeof(args) - 1);
+ ast_copy_string(args, data, sizeof(args));
/* Answer the channel if it's not up */
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c
index 0ce58bbd0..20f6c6569 100755
--- a/apps/app_zapscan.c
+++ b/apps/app_zapscan.c
@@ -332,7 +332,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
}
if ( tempchan && tempchan->type && (!strcmp(tempchan->type, "Zap")) && (tempchan != chan) ) {
ast_verbose(VERBOSE_PREFIX_3 "Zap channel %s is in-use, monitoring...\n", tempchan->name);
- strncpy(confstr, tempchan->name, sizeof(confstr) - 1);
+ ast_copy_string(confstr, tempchan->name, sizeof(confstr));
ast_mutex_unlock(&tempchan->lock);
if ((tmp = strchr(confstr,'-'))) {
*tmp = '\0';