diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index e4fa60885944568d243c537928533a0748c9d6e6..783463c43a453e01b3779d6feb928f6c7c56bb64 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3336,6 +3336,7 @@ static int retrieve_file(char *dir, int msgnum) fprintf(f, "[message]\n"); for (x = 0; x < colcount; x++) { rowdata[0] = '\0'; + colsize = 0; collen = sizeof(coltitle); res = SQLDescribeCol(stmt, x + 1, (unsigned char *) coltitle, sizeof(coltitle), &collen, &datatype, &colsize, &decimaldigits, &nullable); diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 8ba91da1b4659f89890c450b6fe9940475457abe..10cf50e832c3c57c5a31bf4f848650671016c682 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -589,7 +589,7 @@ static int acf_odbc_read(struct ast_channel *chan, const char *cmd, char *s, cha if (y == 0) { char colname[256]; - SQLULEN maxcol; + SQLULEN maxcol = 0; res = SQLDescribeCol(stmt, x + 1, (unsigned char *)colname, sizeof(colname), &collength, NULL, &maxcol, NULL, NULL); ast_debug(3, "Got collength of %d and maxcol of %d for column '%s' (offset %d)\n", (int)collength, (int)maxcol, colname, x); @@ -1197,6 +1197,8 @@ static char *cli_odbc_read(struct ast_cli_entry *e, int cmd, struct ast_cli_args } for (;;) { for (x = 0; x < colcount; x++) { + maxcol = 0; + res = SQLDescribeCol(stmt, x + 1, (unsigned char *)colname, sizeof(colname), &collength, NULL, &maxcol, NULL, NULL); if (((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) || collength == 0) { snprintf(colname, sizeof(colname), "field%d", x); diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c index c076555fa3e53f3bab920486d1f257da5b50ee07..b31241235e9ae76628184b53e9acc41bacc1f407 100644 --- a/res/res_config_odbc.c +++ b/res/res_config_odbc.c @@ -238,6 +238,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl } for (x = 0; x < colcount; x++) { rowdata[0] = '\0'; + colsize = 0; collen = sizeof(coltitle); res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen, &datatype, &colsize, &decimaldigits, &nullable); @@ -410,6 +411,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char * } for (x=0;x<colcount;x++) { rowdata[0] = '\0'; + colsize = 0; collen = sizeof(coltitle); res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen, &datatype, &colsize, &decimaldigits, &nullable);