From d045d9c15999deb4a29a61a53662f7ccf49f3768 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Fri, 11 Nov 2016 14:13:36 -0600 Subject: [PATCH] FS-9727: raise size limit on unkown size odbc column data from 256 to 16k --- src/switch_odbc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 04078c9c5f..cef334fb46 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -611,13 +611,17 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable); if (!ColumnSize) { - ColumnSize = 255; - } - ColumnSize++; + SQLCHAR val[16384] = { 0 }; + ColumnSize = 16384; + SQLGetData(stmt, x, SQL_C_CHAR, val, ColumnSize, NULL); + vals[y] = strdup((char *)val); + } else { + ColumnSize++; - vals[y] = malloc(ColumnSize); - memset(vals[y], 0, ColumnSize); - SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL); + vals[y] = malloc(ColumnSize); + memset(vals[y], 0, ColumnSize); + SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL); + } y++; }