[PATCH] 0.91 segfault in SQLTables
Lionel Elie Mamane <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hi, Attached is the patch I apply to my local copy of FreeTDS. It solves a segfault when connecting to MS SQL Server or Sybase SQL Anywhere from LibreOffice, when LibreOffice calls SQLTables(). Also attached a backtrace of the segfault. -- Lionel _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds
FREETDS_BUG
(text/plain, 1 KB)
#0 0x00007fb82705365c in tds_quote (tds=0x33a3a20, buffer=0x0, quoting=93 ']', id=
0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>, len=1106707232) at query.c:2184
#1 0x00007fb82705378c in tds_quote_id (tds=0x33a3a20, buffer=0x0, id=0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>,
idlen=1106707232) at query.c:2222
#2 0x00007fb827027ff6 in odbc_stat_execute (stmt=0x34e9cc0, begin=0x7fb8270698cf "..sp_tables", nparams=4) at odbc.c:7049
#3 0x00007fb827027492 in _SQLTables (hstmt=0x34e9cc0, szCatalogName=0x34e5118 "APSAL", cbCatalogName=-3, szSchemaName=0x34e5138 "dbo",
cbSchemaName=-3, szTableName=0x34e4208 "ANALYTIC_VENTILATION", cbTableName=-3, szTableType=0x34e9ee8 "VIEW,TABLE,%,", cbTableType=-3)
at odbc.c:6793
#4 0x00007fb827026d3c in SQLTables (hstmt=0x34e9cc0, szCatalogName=0x34e5118 "APSAL", cbCatalogName=-3, szSchemaName=0x34e5138 "dbo",
cbSchemaName=-3, szTableName=0x34e4208 "ANALYTIC_VENTILATION", cbTableName=-3, szTableType=0x34e9ee8 "VIEW,TABLE,%,", cbTableType=-3)
at sqlwparams.h:113
freetds.patch
(text/x-diff, 510 B)
--- freetds-0.91.orig/src/odbc/odbc.c
+++ freetds-0.91/src/odbc/odbc.c
@@ -7046,9 +7046,9 @@
len += strlen(params[i].name) + odbc_quote_metadata(stmt->dbc, params[i].type, NULL,
¶ms[i].value) + 3;
if (begin[0] == '.' && strstr(params[i].name, "qualifier")) {
+ param_qualifier = i;
len += tds_quote_id(stmt->dbc->tds_socket, NULL,
tds_dstr_cstr(¶ms[param_qualifier].value), tds_dstr_len(¶ms[param_qualifier].value));
- param_qualifier = i;
}
}