int l1 = strlen(e1->exten) + strlen(e1->cidmatch) + 2;
- strncpy(extenbuf,e1->exten,sizeof(extenbuf));
+ ast_copy_string(extenbuf, e1->exten, sizeof(extenbuf));
+
if (e1->matchcid && l1 <= sizeof(extenbuf)) {
strcat(extenbuf,"/");
strcat(extenbuf,e1->cidmatch);
{
struct ast_context *tmp = NULL;
struct fake_context item;
- strncpy(item.name,name,256);
+
+ ast_copy_string(item.name, name, sizeof(item.name));
+
ast_rdlock_contexts();
if( contexts_table ) {
tmp = ast_hashtab_lookup(contexts_table,&item);
tmp = bypass;
else { /* look in contexts */
struct fake_context item;
- strncpy(item.name,context,256);
- tmp = ast_hashtab_lookup(contexts_table,&item);
+
+ ast_copy_string(item.name, context, sizeof(item.name));
+
+ tmp = ast_hashtab_lookup(contexts_table, &item);
#ifdef NOTNOW
tmp = NULL;
while ((tmp = ast_walk_contexts(tmp)) ) {
ast_rdlock_contexts();
- strncpy(item.name,context,256);
+ ast_copy_string(item.name, context, sizeof(item.name));
+
c = ast_hashtab_lookup(contexts_table,&item);
if (c)
ret = 0;
ast_rdlock_contexts();
- strncpy(item.name, context, 256);
+ ast_copy_string(item.name, context, sizeof(item.name));
+
c = ast_hashtab_lookup(contexts_table,&item);
if (c)
ret = 0;
0);
}
- strncpy(search.name,name,sizeof(search.name));
+ ast_copy_string(search.name, name, sizeof(search.name));
if (!extcontexts) {
ast_rdlock_contexts();
local_contexts = &contexts;
if (con->pattern_tree) { /* usually, on initial load, the pattern_tree isn't formed until the first find_exten; so if we are adding
an extension, and the trie exists, then we need to incrementally add this pattern to it. */
- strncpy(dummy_name,extension,sizeof(dummy_name));
+ ast_copy_string(dummy_name, extension, sizeof(dummy_name));
dummy_exten.exten = dummy_name;
dummy_exten.matchcid = 0;
dummy_exten.cidmatch = 0;