Merged revisions 46200 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46200 | kpfleming | 2006-10-25 09:32:08 -0500 (Wed, 25 Oct 2006) | 2 lines

apparently developers are still not aware that they should be use ast_copy_string instead of strncpy... fix up many more users, and fix some bugs in the process

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2006-10-25 14:44:50 +00:00
parent c30f1d12c5
commit 749029de38
27 changed files with 187 additions and 214 deletions

View File

@@ -870,13 +870,13 @@ static void check_includes(pval *includes)
static void check_timerange(pval *p)
{
char times[200];
char *times;
char *e;
int s1, s2;
int e1, e2;
times = ast_strdupa(p->u1.str);
strncpy(times, p->u1.str, sizeof(times));
/* Star is all times */
if (ast_strlen_zero(times) || !strcmp(times, "*")) {
return;
@@ -938,13 +938,13 @@ static char *days[] =
/*! \brief get_dow: Get day of week */
static void check_dow(pval *DOW)
{
char dow[200];
char *dow;
char *c;
/* The following line is coincidence, really! */
int s, e;
strncpy(dow,DOW->u1.str,sizeof(dow));
dow = ast_strdupa(DOW->u1.str);
/* Check for all days */
if (ast_strlen_zero(dow) || !strcmp(dow, "*"))
return;
@@ -977,12 +977,13 @@ static void check_dow(pval *DOW)
static void check_day(pval *DAY)
{
char day[200];
char *day;
char *c;
/* The following line is coincidence, really! */
int s, e;
strncpy(day,DAY->u1.str,sizeof(day));
day = ast_strdupa(DAY->u1.str);
/* Check for all days */
if (ast_strlen_zero(day) || !strcmp(day, "*")) {
return;
@@ -1039,12 +1040,13 @@ static char *months[] =
static void check_month(pval *MON)
{
char mon[200];
char *mon;
char *c;
/* The following line is coincidence, really! */
int s, e;
strncpy(mon,MON->u1.str,sizeof(mon));
mon = ast_strdupa(MON->u1.str);
/* Check for all days */
if (ast_strlen_zero(mon) || !strcmp(mon, "*"))
return ;
@@ -1993,14 +1995,14 @@ int is_empty(char *arg)
int option_matches_j( struct argdesc *should, pval *is, struct argapp *app)
{
struct argchoice *ac;
char opcop[400],*q,*p;
char *opcop,*q,*p;
switch (should->dtype) {
case ARGD_OPTIONSET:
if ( strstr(is->u1.str,"${") )
return 0; /* no checking anything if there's a var reference in there! */
strncpy(opcop,is->u1.str,sizeof(opcop));
opcop = ast_strdupa(is->u1.str);
for (q=opcop;*q;q++) { /* erase the innards of X(innard) type arguments, so we don't get confused later */
if ( *q == '(' ) {
@@ -2055,7 +2057,7 @@ int option_matches_j( struct argdesc *should, pval *is, struct argapp *app)
int option_matches( struct argdesc *should, pval *is, struct argapp *app)
{
struct argchoice *ac;
char opcop[400];
char *opcop;
switch (should->dtype) {
case ARGD_STRING:
@@ -2090,7 +2092,7 @@ int option_matches( struct argdesc *should, pval *is, struct argapp *app)
break;
case ARGD_OPTIONSET:
strncpy(opcop,is->u1.str,sizeof(opcop));
opcop = ast_strdupa(is->u1.str);
for (ac=app->opts; ac; ac=ac->next) {
if (strlen(ac->name)>1 && strchr(ac->name,'(') == 0 && strcmp(ac->name,is->u1.str) == 0) /* multichar option, no parens, and a match? */
@@ -2182,7 +2184,7 @@ void check_switch_expr(pval *item, struct argapp *apps)
{
#ifdef AAL_ARGCHECK
/* get and clean the variable name */
char buff1[1024],*p;
char *buff1, *p;
struct argapp *a,*a2;
struct appsetvar *v,*v2;
struct argchoice *c;
@@ -2192,7 +2194,8 @@ void check_switch_expr(pval *item, struct argapp *apps)
while (p && *p && (*p == ' ' || *p == '\t' || *p == '$' || *p == '{' ) )
p++;
strncpy(buff1,p,sizeof(buff1));
buff1 = ast_strdupa(p);
while (strlen(buff1) > 0 && ( buff1[strlen(buff1)-1] == '}' || buff1[strlen(buff1)-1] == ' ' || buff1[strlen(buff1)-1] == '\t'))
buff1[strlen(buff1)-1] = 0;
/* buff1 now contains the variable name */