diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:22:30 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:22:30 +0000 |
commit | 59d780973e0c1aab681be9dcba1baa2706caf92f (patch) | |
tree | 069cf4d5aa497e953fd1467abefc88134b3fc727 /apps/app_disa.c | |
parent | 8e06b188edfed3926b0e640a2294525b3488ccdf (diff) |
Merge rgagnon's pedantic string checks (apps a-m, bug #2035)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3428 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_disa.c')
-rwxr-xr-x | apps/app_disa.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/app_disa.c b/apps/app_disa.c index 132f86efa..3022c9edc 100755 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -116,7 +116,7 @@ static int disa_exec(struct ast_channel *chan, void *data) { int i,j,k,x; struct localuser *u; - char tmp[256],arg2[256],exten[AST_MAX_EXTENSION],acctcode[20]; + char tmp[256],arg2[256]="",exten[AST_MAX_EXTENSION],acctcode[20]=""; struct { unsigned char offset[AST_FRIENDLY_OFFSET]; unsigned char buf[640]; @@ -149,7 +149,7 @@ static int disa_exec(struct ast_channel *chan, void *data) ourcontext = strsep(&stringp, "|"); /* if context specified, save 2nd arg and parse third */ if (ourcontext) { - strcpy(arg2,ourcontext); + strncpy(arg2,ourcontext, sizeof(arg2) - 1); ourcallerid = strsep(&stringp,"|"); } /* if context not specified, use "disa" */ @@ -291,7 +291,7 @@ static int disa_exec(struct ast_channel *chan, void *data) k = 1; i = 0; /* re-set buffer pointer */ exten[sizeof(acctcode)] = 0; - strcpy(acctcode,exten); + strncpy(acctcode,exten, sizeof(acctcode) - 1); exten[0] = 0; ast_log(LOG_DEBUG,"Successful DISA log-in on chan %s\n",chan->name); continue; @@ -316,9 +316,9 @@ static int disa_exec(struct ast_channel *chan, void *data) if (chan->callerid) free(chan->callerid); chan->callerid = strdup(ourcallerid); } - strcpy(chan->exten,exten); - strcpy(chan->context,ourcontext); - strcpy(chan->accountcode,acctcode); + strncpy(chan->exten, exten, sizeof(chan->exten) - 1); + strncpy(chan->context, ourcontext, sizeof(chan->context) - 1); + strncpy(chan->accountcode, acctcode, sizeof(chan->accountcode) - 1); chan->priority = 0; ast_cdr_init(chan->cdr,chan); LOCAL_USER_REMOVE(u); |