Last set of strncpy/snprintf updates (bug #2049)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3446 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-07-16 04:40:54 +00:00
parent 78117423fa
commit bba1faf910
17 changed files with 320 additions and 279 deletions

View File

@@ -70,17 +70,20 @@ static struct iax_flag {
char *iax_provflags2str(char *buf, int buflen, unsigned int flags)
{
int x;
strcpy(buf, "");
if (!buf || buflen < 1) {
return(NULL);
}
buf[0] = '\0';
for (x=0;x<sizeof(iax_flags) / sizeof(iax_flags[0]); x++) {
if (flags & iax_flags[x].value){
strcat(buf, iax_flags[x].name);
strcat(buf, ",");
strncat(buf, iax_flags[x].name, buflen - strlen(buf) - 1);
strncat(buf, ",", buflen - strlen(buf) - 1);
}
}
if (strlen(buf))
buf[strlen(buf) - 1] = '\0';
else
strcpy(buf, "none");
strncpy(buf, "none", buflen - 1);
return buf;
}
@@ -276,7 +279,7 @@ static int iax_template_parse(struct iax_template *cur, struct ast_config *cfg,
if (def)
strncpy(cur->src, def, sizeof(cur->src) - 1);
else
strcpy(cur->src, "");
cur->src[0] = '\0';
v = ast_variable_browse(cfg, s);
while(v) {
if (!strcasecmp(v->name, "port") || !strcasecmp(v->name, "serverport")) {