diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 13:57:15 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 13:57:15 +0000 |
commit | 5d8654361451b217b1fc604f449554e74a11b70b (patch) | |
tree | 30a1118273807f5c6ba0e3ca611ab0c6a160fa3b /cdr/cdr_odbc.c | |
parent | 3aea726c3943cf31d2d90c194d1e126891b1481d (diff) |
Merge remaining audit patch (save dlfcn.c)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3436 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_odbc.c')
-rwxr-xr-x | cdr/cdr_odbc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c index 6cfe62211..e52730f2e 100755 --- a/cdr/cdr_odbc.c +++ b/cdr/cdr_odbc.c @@ -56,25 +56,25 @@ static int odbc_log(struct ast_cdr *cdr) short int ODBC_mlen; int ODBC_res; char ODBC_msg[200], ODBC_stat[10]; - char sqlcmd[2048], timestr[128]; + char sqlcmd[2048] = "", timestr[128]; int res = 0; struct tm tm; localtime_r(&cdr->start.tv_sec,&tm); ast_mutex_lock(&odbc_lock); - strftime(timestr,128,DATE_FORMAT,&tm); + strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm); memset(sqlcmd,0,2048); if((loguniqueid != NULL) && ((strcmp(loguniqueid, "1") == 0) || (strcmp(loguniqueid, "yes") == 0))) { - sprintf(sqlcmd,"INSERT INTO cdr " + snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO cdr " "(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp," "lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); } else { - sprintf(sqlcmd,"INSERT INTO cdr " + snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO cdr " "(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata," "duration,billsec,disposition,amaflags,accountcode) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); @@ -264,8 +264,9 @@ static int odbc_load_module(void) dsn = malloc(strlen(tmp) + 1); if (dsn != NULL) { + memset(dsn, 0, strlen(tmp) + 1); dsn_alloc = 1; - strcpy(dsn,tmp); + strncpy(dsn, tmp, strlen(tmp)); } else { @@ -285,8 +286,9 @@ static int odbc_load_module(void) username = malloc(strlen(tmp) + 1); if (username != NULL) { + memset(username, 0, strlen(tmp) + 1); username_alloc = 1; - strcpy(username,tmp); + strncpy(username, tmp, strlen(tmp)); } else { @@ -306,8 +308,9 @@ static int odbc_load_module(void) password = malloc(strlen(tmp) + 1); if (password != NULL) { + memset(password, 0, strlen(tmp) + 1); password_alloc = 1; - strcpy(password,tmp); + strncpy(password, tmp, strlen(tmp)); } else { |