mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Convert some strncpys to ast_copy_string
Review: https://reviewboard.asterisk.org/r/1732/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -311,7 +311,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
|
||||
ast_mutex_unlock(&provlock);
|
||||
}
|
||||
if (def)
|
||||
strncpy(cur->src, def, sizeof(cur->src) - 1);
|
||||
ast_copy_string(cur->src, def, sizeof(cur->src));
|
||||
else
|
||||
cur->src[0] = '\0';
|
||||
v = ast_variable_browse(cfg, s);
|
||||
@@ -347,15 +347,15 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
|
||||
if (ast_str2tos(v->value, &cur->tos))
|
||||
ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
|
||||
} else if (!strcasecmp(v->name, "user")) {
|
||||
strncpy(cur->user, v->value, sizeof(cur->user) - 1);
|
||||
ast_copy_string(cur->user, v->value, sizeof(cur->user));
|
||||
if (strcmp(cur->user, v->value))
|
||||
ast_log(LOG_WARNING, "Truncating username from '%s' to '%s' for '%s' at line %d\n", v->value, cur->user, s, v->lineno);
|
||||
} else if (!strcasecmp(v->name, "pass")) {
|
||||
strncpy(cur->pass, v->value, sizeof(cur->pass) - 1);
|
||||
ast_copy_string(cur->pass, v->value, sizeof(cur->pass));
|
||||
if (strcmp(cur->pass, v->value))
|
||||
ast_log(LOG_WARNING, "Truncating password from '%s' to '%s' for '%s' at line %d\n", v->value, cur->pass, s, v->lineno);
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(cur->lang, v->value, sizeof(cur->lang) - 1);
|
||||
ast_copy_string(cur->lang, v->value, sizeof(cur->lang));
|
||||
if (strcmp(cur->lang, v->value))
|
||||
ast_log(LOG_WARNING, "Truncating language from '%s' to '%s' for '%s' at line %d\n", v->value, cur->lang, s, v->lineno);
|
||||
} else if (!strcasecmp(v->name, "flags")) {
|
||||
@@ -391,7 +391,7 @@ static int iax_process_template(struct ast_config *cfg, char *s, char *def)
|
||||
return -1;
|
||||
}
|
||||
/* Initialize entry */
|
||||
strncpy(cur->name, s, sizeof(cur->name) - 1);
|
||||
ast_copy_string(cur->name, s, sizeof(cur->name));
|
||||
cur->dead = 1;
|
||||
}
|
||||
if (!iax_template_parse(cur, cfg, s, def))
|
||||
|
Reference in New Issue
Block a user