mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
more ast_copy_string conversions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6074 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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);
|
ast_log(LOG_WARNING, "No more flag space at line %d of %s\n", lineno, script);
|
||||||
return NULL;
|
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->flags[state->numflags].id = state->numflags + 1;
|
||||||
state->numflags++;
|
state->numflags++;
|
||||||
return &state->flags[state->numflags-1];
|
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);
|
ast_log(LOG_WARNING, "No more key space at line %d of %s\n", lineno, script);
|
||||||
return NULL;
|
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->keys[state->numkeys].id = state->numkeys + 2;
|
||||||
state->numkeys++;
|
state->numkeys++;
|
||||||
return &state->keys[state->numkeys-1];
|
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);
|
ast_log(LOG_WARNING, "No more subscript space at line %d of %s\n", lineno, script);
|
||||||
return NULL;
|
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->subs[state->numsubs].id = state->numsubs;
|
||||||
state->numsubs++;
|
state->numsubs++;
|
||||||
return &state->subs[state->numsubs-1];
|
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);
|
ast_log(LOG_WARNING, "No more state space at line %d of %s\n", lineno, script);
|
||||||
return NULL;
|
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->states[state->numstates].id = state->numstates + 1;
|
||||||
state->numstates++;
|
state->numstates++;
|
||||||
return &state->states[state->numstates-1];
|
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);
|
ast_log(LOG_WARNING, "No more display space at line %d of %s\n", lineno, script);
|
||||||
return NULL;
|
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->displays[state->numdisplays].id = state->numdisplays + 1;
|
||||||
state->numdisplays++;
|
state->numdisplays++;
|
||||||
return &state->displays[state->numdisplays-1];
|
return &state->displays[state->numdisplays-1];
|
||||||
@@ -1045,7 +1045,7 @@ static int adsi_process(struct adsi_script *state, char *buf, char *script, int
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strncpy(tmp2, tmp, sizeof(tmp2) - 1);
|
ast_copy_string(tmp2, tmp, sizeof(tmp2));
|
||||||
}
|
}
|
||||||
if (strlen(tmp2) > 18) {
|
if (strlen(tmp2) > 18) {
|
||||||
ast_log(LOG_WARNING, "Truncating full name to 18 characters at line %d of %s\n", lineno, script);
|
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;
|
int x, err;
|
||||||
struct adsi_script *scr;
|
struct adsi_script *scr;
|
||||||
if (script[0] == '/')
|
if (script[0] == '/')
|
||||||
strncpy(fn, script, sizeof(fn) - 1);
|
ast_copy_string(fn, script, sizeof(fn));
|
||||||
else
|
else
|
||||||
snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, script);
|
snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, script);
|
||||||
f = fopen(fn, "r");
|
f = fopen(fn, "r");
|
||||||
|
@@ -310,7 +310,7 @@ static int write_metadata( FILE *logfile, char *signalling_type, struct ast_chan
|
|||||||
|
|
||||||
/* Extract the caller ID location */
|
/* Extract the caller ID location */
|
||||||
if (chan->cid.cid_num)
|
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';
|
workstring[sizeof(workstring) - 1] = '\0';
|
||||||
|
|
||||||
ast_callerid_parse(workstring, &cn, &cl);
|
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 */
|
/* 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);
|
strncat(workstring, event_file, sizeof(workstring) - strlen(workstring) - 1);
|
||||||
|
|
||||||
/* Make the temporary file */
|
/* 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));
|
memset(enew, 0, sizeof(event_node_t));
|
||||||
|
|
||||||
enew->next = NULL;
|
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
|
* 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 */
|
/* 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 */
|
/* Answer the channel if it is not already */
|
||||||
@@ -751,7 +751,7 @@ static int load_config(void)
|
|||||||
p = ast_variable_retrieve(cfg, "general", "eventcmd");
|
p = ast_variable_retrieve(cfg, "general", "eventcmd");
|
||||||
|
|
||||||
if(p){
|
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';
|
event_app[sizeof(event_app) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,21 +791,21 @@ static int load_config(void)
|
|||||||
p = ast_variable_retrieve(cfg, "general", "eventspooldir");
|
p = ast_variable_retrieve(cfg, "general", "eventspooldir");
|
||||||
|
|
||||||
if(p){
|
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';
|
event_spool_dir[sizeof(event_spool_dir) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
p = ast_variable_retrieve(cfg, "general", "timestampformat");
|
p = ast_variable_retrieve(cfg, "general", "timestampformat");
|
||||||
|
|
||||||
if(p){
|
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';
|
time_stamp_format[sizeof(time_stamp_format) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
p = ast_variable_retrieve(cfg, "general", "db-family");
|
p = ast_variable_retrieve(cfg, "general", "db-family");
|
||||||
|
|
||||||
if(p){
|
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';
|
db_family[sizeof(db_family) - 1] = '\0';
|
||||||
}
|
}
|
||||||
ast_config_destroy(cfg);
|
ast_config_destroy(cfg);
|
||||||
|
@@ -183,9 +183,9 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, char *dia
|
|||||||
/* Name selected */
|
/* Name selected */
|
||||||
loop = 0;
|
loop = 0;
|
||||||
if (ast_exists_extension(chan,dialcontext,ext,1,chan->cid.cid_num)) {
|
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;
|
chan->priority = 0;
|
||||||
strncpy(chan->context, dialcontext, sizeof(chan->context)-1);
|
ast_copy_string(chan->context, dialcontext, sizeof(chan->context));
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Can't find extension '%s' in context '%s'. "
|
"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) ||
|
if (ast_exists_extension(chan,chan->context,"o",1,chan->cid.cid_num) ||
|
||||||
(!ast_strlen_zero(chan->macrocontext) &&
|
(!ast_strlen_zero(chan->macrocontext) &&
|
||||||
ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num))) {
|
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;
|
chan->priority = 0;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} 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) ||
|
if (ast_exists_extension(chan,chan->context,"a",1,chan->cid.cid_num) ||
|
||||||
(!ast_strlen_zero(chan->macrocontext) &&
|
(!ast_strlen_zero(chan->macrocontext) &&
|
||||||
ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num))) {
|
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;
|
chan->priority = 0;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -337,7 +337,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
|
|||||||
strsep(&stringp, ",");
|
strsep(&stringp, ",");
|
||||||
pos = strsep(&stringp, ",");
|
pos = strsep(&stringp, ",");
|
||||||
if (pos) {
|
if (pos) {
|
||||||
strncpy(name, pos, sizeof(name) - 1);
|
ast_copy_string(name, pos, sizeof(name));
|
||||||
/* Grab the last name */
|
/* Grab the last name */
|
||||||
if (last && strrchr(pos,' '))
|
if (last && strrchr(pos,' '))
|
||||||
pos = strrchr(pos, ' ') + 1;
|
pos = strrchr(pos, ' ') + 1;
|
||||||
@@ -371,8 +371,8 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
|
|||||||
case '1':
|
case '1':
|
||||||
/* user pressed '1' and extensions exists */
|
/* user pressed '1' and extensions exists */
|
||||||
lastuserchoice = res;
|
lastuserchoice = res;
|
||||||
strncpy(chan->context, dialcontext, sizeof(chan->context) - 1);
|
ast_copy_string(chan->context, dialcontext, sizeof(chan->context));
|
||||||
strncpy(chan->exten, v->name, sizeof(chan->exten) - 1);
|
ast_copy_string(chan->exten, v->name, sizeof(chan->exten));
|
||||||
chan->priority = 0;
|
chan->priority = 0;
|
||||||
break;
|
break;
|
||||||
case '*':
|
case '*':
|
||||||
|
@@ -124,11 +124,11 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
LOCAL_USER_ADD(u);
|
LOCAL_USER_ADD(u);
|
||||||
/* Save old info */
|
/* Save old info */
|
||||||
oldpriority = chan->priority;
|
oldpriority = chan->priority;
|
||||||
strncpy(oldexten, chan->exten, sizeof(oldexten) - 1);
|
ast_copy_string(oldexten, chan->exten, sizeof(oldexten));
|
||||||
strncpy(oldcontext, chan->context, sizeof(oldcontext) - 1);
|
ast_copy_string(oldcontext, chan->context, sizeof(oldcontext));
|
||||||
if (ast_strlen_zero(chan->macrocontext)) {
|
if (ast_strlen_zero(chan->macrocontext)) {
|
||||||
strncpy(chan->macrocontext, chan->context, sizeof(chan->macrocontext) - 1);
|
ast_copy_string(chan->macrocontext, chan->context, sizeof(chan->macrocontext));
|
||||||
strncpy(chan->macroexten, chan->exten, sizeof(chan->macroexten) - 1);
|
ast_copy_string(chan->macroexten, chan->exten, sizeof(chan->macroexten));
|
||||||
chan->macropriority = chan->priority;
|
chan->macropriority = chan->priority;
|
||||||
setmacrocontext=1;
|
setmacrocontext=1;
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
/* Setup environment for new run */
|
/* Setup environment for new run */
|
||||||
chan->exten[0] = 's';
|
chan->exten[0] = 's';
|
||||||
chan->exten[1] = '\0';
|
chan->exten[1] = '\0';
|
||||||
strncpy(chan->context, fullmacro, sizeof(chan->context) - 1);
|
ast_copy_string(chan->context, fullmacro, sizeof(chan->context));
|
||||||
chan->priority = 1;
|
chan->priority = 1;
|
||||||
|
|
||||||
while((cur = strsep(&rest, "|")) && (argc < MAX_ARGS)) {
|
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 (!strcasecmp(chan->context, fullmacro)) {
|
||||||
/* If we're leaving the macro normally, restore original information */
|
/* If we're leaving the macro normally, restore original information */
|
||||||
chan->priority = oldpriority;
|
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)) {
|
if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
|
||||||
/* Copy the extension, so long as we're not in softhangup, where we could be given an 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"))) {
|
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
|
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
|
||||||
normally if there is any problem */
|
normally if there is any problem */
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Asterisk -- A telephony toolkit for Linux.
|
* Asterisk -- A telephony toolkit for Linux.
|
||||||
*
|
*
|
||||||
* simple maths application
|
* simple math application
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004 - 2005, Andy Powell
|
* Copyright (C) 2004 - 2005, Andy Powell
|
||||||
*
|
*
|
||||||
@@ -199,33 +199,33 @@ static int math_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
case GTFUNCTION :
|
case GTFUNCTION :
|
||||||
if (fnum1 > fnum2)
|
if (fnum1 > fnum2)
|
||||||
strncpy (user_result, "TRUE", sizeof (user_result) - 1);
|
strcpy(user_result, "TRUE");
|
||||||
else
|
else
|
||||||
strncpy (user_result, "FALSE", sizeof (user_result) - 1);
|
strcpy(user_result, "FALSE");
|
||||||
break;
|
break;
|
||||||
case LTFUNCTION :
|
case LTFUNCTION :
|
||||||
if (fnum1 < fnum2)
|
if (fnum1 < fnum2)
|
||||||
strncpy (user_result, "TRUE", sizeof (user_result) - 1);
|
strcpy(user_result, "TRUE");
|
||||||
else
|
else
|
||||||
strncpy (user_result, "FALSE", sizeof (user_result) - 1);
|
strcpy(user_result, "FALSE");
|
||||||
break;
|
break;
|
||||||
case GTEFUNCTION :
|
case GTEFUNCTION :
|
||||||
if (fnum1 >= fnum2)
|
if (fnum1 >= fnum2)
|
||||||
strncpy (user_result, "TRUE", sizeof (user_result) - 1);
|
strcpy(user_result, "TRUE");
|
||||||
else
|
else
|
||||||
strncpy (user_result, "FALSE", sizeof (user_result) - 1);
|
strcpy(user_result, "FALSE");
|
||||||
break;
|
break;
|
||||||
case LTEFUNCTION :
|
case LTEFUNCTION :
|
||||||
if (fnum1 <= fnum2)
|
if (fnum1 <= fnum2)
|
||||||
strncpy (user_result, "TRUE", sizeof (user_result) - 1);
|
strcpy(user_result, "TRUE");
|
||||||
else
|
else
|
||||||
strncpy (user_result, "FALSE", sizeof (user_result) - 1);
|
strcpy(user_result, "FALSE");
|
||||||
break;
|
break;
|
||||||
case EQFUNCTION :
|
case EQFUNCTION :
|
||||||
if (fnum1 == fnum2)
|
if (fnum1 == fnum2)
|
||||||
strncpy (user_result, "TRUE", sizeof (user_result) - 1);
|
strcpy(user_result, "TRUE");
|
||||||
else
|
else
|
||||||
strncpy (user_result, "FALSE", sizeof (user_result) - 1);
|
strcpy(user_result, "FALSE");
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
ast_log(LOG_WARNING, "Something happened that neither of us should be proud of %d\n", iaction);
|
ast_log(LOG_WARNING, "Something happened that neither of us should be proud of %d\n", iaction);
|
||||||
|
@@ -93,7 +93,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
|
|||||||
char *opt;
|
char *opt;
|
||||||
int anitoo = 0;
|
int anitoo = 0;
|
||||||
if (data)
|
if (data)
|
||||||
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
|
ast_copy_string(tmp, (char *)data, sizeof(tmp));
|
||||||
opt = strchr(tmp, '|');
|
opt = strchr(tmp, '|');
|
||||||
if (opt) {
|
if (opt) {
|
||||||
*opt = '\0';
|
*opt = '\0';
|
||||||
|
@@ -61,7 +61,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
|
ast_copy_string(tmp, (char *)data, sizeof(tmp));
|
||||||
opt = strchr(tmp, '|');
|
opt = strchr(tmp, '|');
|
||||||
if (opt) {
|
if (opt) {
|
||||||
*opt = '\0';
|
*opt = '\0';
|
||||||
|
@@ -63,7 +63,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
|
ast_copy_string(tmp, (char *)data, sizeof(tmp));
|
||||||
opt = strchr(tmp, '|');
|
opt = strchr(tmp, '|');
|
||||||
if (opt) {
|
if (opt) {
|
||||||
*opt = '\0';
|
*opt = '\0';
|
||||||
|
@@ -59,7 +59,7 @@ static int setrdnis_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
|
ast_copy_string(tmp, (char *)data, sizeof(tmp));
|
||||||
else
|
else
|
||||||
tmp[0] = '\0';
|
tmp[0] = '\0';
|
||||||
opt = strchr(tmp, '|');
|
opt = strchr(tmp, '|');
|
||||||
|
@@ -66,7 +66,7 @@ static int settransfercapability_exec(struct ast_channel *chan, void *data)
|
|||||||
int transfercapability = -1;
|
int transfercapability = -1;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
strncpy(tmp, (char *)data, sizeof(tmp) - 1);
|
ast_copy_string(tmp, (char *)data, sizeof(tmp));
|
||||||
opts = strchr(tmp, '|');
|
opts = strchr(tmp, '|');
|
||||||
if (opts)
|
if (opts)
|
||||||
*opts = '\0';
|
*opts = '\0';
|
||||||
|
@@ -848,11 +848,11 @@ static void sms_writefile (sms_t * h)
|
|||||||
{
|
{
|
||||||
char fn[200] = "", fn2[200] = "";
|
char fn[200] = "", fn2[200] = "";
|
||||||
FILE *o;
|
FILE *o;
|
||||||
strncpy (fn, spool_dir, sizeof (fn) - 1);
|
ast_copy_string (fn, spool_dir, sizeof (fn));
|
||||||
mkdir (fn, 0777); /* ensure it exists */
|
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");
|
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 */
|
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 (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);
|
snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/.%s", fn2 + strlen (fn) + 1);
|
||||||
o = fopen (fn, "w");
|
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->srr = ((h->imsg[2] & 0x20) ? 1 : 0);
|
||||||
h->udhi = ((h->imsg[2] & 0x40) ? 1 : 0);
|
h->udhi = ((h->imsg[2] & 0x40) ? 1 : 0);
|
||||||
h->rp = ((h->imsg[2] & 0x80) ? 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->scts = time (0);
|
||||||
h->mr = h->imsg[p++];
|
h->mr = h->imsg[p++];
|
||||||
p += unpackaddress (h->da, 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] = "";
|
char fn[100 + NAME_MAX] = "";
|
||||||
DIR *d;
|
DIR *d;
|
||||||
char more = 0;
|
char more = 0;
|
||||||
strncpy (fn, spool_dir, sizeof (fn) - 1);
|
ast_copy_string (fn, spool_dir, sizeof (fn));
|
||||||
mkdir (fn, 0777); /* ensure it exists */
|
mkdir (fn, 0777); /* ensure it exists */
|
||||||
h->rx = 0; /* outgoing message */
|
h->rx = 0; /* outgoing message */
|
||||||
snprintf (fn + strlen (fn), sizeof (fn) - strlen (fn), "/%s", h->smsc ? "mttx" : "motx");
|
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)
|
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,
|
unsigned char *d = data,
|
||||||
@@ -1422,12 +1422,12 @@ static int sms_exec (struct ast_channel *chan, void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (h.smsc) {
|
if (h.smsc) {
|
||||||
strncpy (h.oa, d, sizeof (h.oa) - 1);
|
ast_copy_string (h.oa, d, sizeof (h.oa));
|
||||||
} else {
|
} else {
|
||||||
strncpy (h.da, d, sizeof (h.da) - 1);
|
ast_copy_string (h.da, d, sizeof (h.da));
|
||||||
}
|
}
|
||||||
if (!h.smsc)
|
if (!h.smsc)
|
||||||
strncpy (h.oa, h.cli, sizeof (h.oa) - 1);
|
ast_copy_string (h.oa, h.cli, sizeof (h.oa));
|
||||||
d = p;
|
d = p;
|
||||||
h.udl = 0;
|
h.udl = 0;
|
||||||
while (*p && h.udl < SMSLEN)
|
while (*p && h.udl < SMSLEN)
|
||||||
|
@@ -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");
|
ast_log(LOG_WARNING, "BackgroundDetect requires an argument (filename)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
strncpy(tmp, (char *)data, sizeof(tmp)-1);
|
ast_copy_string(tmp, (char *)data, sizeof(tmp));
|
||||||
stringp=tmp;
|
stringp=tmp;
|
||||||
strsep(&stringp, "|");
|
strsep(&stringp, "|");
|
||||||
options = 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);
|
pbx_builtin_setvar_helper(chan, "TALK_DETECTED", ms_str);
|
||||||
|
|
||||||
if (ast_exists_extension(chan, chan->context, "talk", 1, chan->cid.cid_num)) {
|
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;
|
chan->priority = 0;
|
||||||
}
|
}
|
||||||
res = 0;
|
res = 0;
|
||||||
|
@@ -95,9 +95,9 @@ static int load_config(void)
|
|||||||
cfg = ast_config_load(ENUM_CONFIG);
|
cfg = ast_config_load(ENUM_CONFIG);
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
if (!(s=ast_variable_retrieve(cfg, "general", "h323driver"))) {
|
if (!(s=ast_variable_retrieve(cfg, "general", "h323driver"))) {
|
||||||
strncpy(h323driver, H323DRIVERDEFAULT, sizeof(h323driver) - 1);
|
ast_copy_string(h323driver, H323DRIVERDEFAULT, sizeof(h323driver));
|
||||||
} else {
|
} else {
|
||||||
strncpy(h323driver, s, sizeof(h323driver) - 1);
|
ast_copy_string(h323driver, s, sizeof(h323driver));
|
||||||
}
|
}
|
||||||
ast_config_destroy(cfg);
|
ast_config_destroy(cfg);
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -193,7 +193,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
|
|||||||
if (!data)
|
if (!data)
|
||||||
data = "";
|
data = "";
|
||||||
LOCAL_USER_ADD(u);
|
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 */
|
/* Answer the channel if it's not up */
|
||||||
if (chan->_state != AST_STATE_UP)
|
if (chan->_state != AST_STATE_UP)
|
||||||
ast_answer(chan);
|
ast_answer(chan);
|
||||||
|
@@ -332,7 +332,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
if ( tempchan && tempchan->type && (!strcmp(tempchan->type, "Zap")) && (tempchan != chan) ) {
|
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);
|
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);
|
ast_mutex_unlock(&tempchan->lock);
|
||||||
if ((tmp = strchr(confstr,'-'))) {
|
if ((tmp = strchr(confstr,'-'))) {
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
Reference in New Issue
Block a user