e81403a315a24af601884b8a19e89bcecc92f267 galt Sat Dec 8 20:04:28 2018 -0800 Fixing hFindSplitTable and its use. Standard size, give real string size so no undetected overflows. Test result and abort if not found. Avoids SQL errors that otherwise will popup. Handles uninitialzed stack better for the output name. refs #22596. diff --git src/hg/lib/hAnno.c src/hg/lib/hAnno.c index d8db9d7..381d12d 100644 --- src/hg/lib/hAnno.c +++ src/hg/lib/hAnno.c @@ -102,33 +102,32 @@ } dyStringAppend(dy, " )\n"); return asParseText(dy->string); } struct asObject *hAnnoGetAutoSqlForDbTable(char *db, char *table, struct trackDb *tdb, boolean skipBin) /* Get autoSql for db.table from optional tdb and/or db.tableDescriptions; * if it doesn't match columns, make one up from db.table sql fields. * Some subtleties are lost in translation from .as to .sql, that's why * we try tdb & db.tableDescriptions first. But ultimately we need to return * an asObj whose columns match all fields of the table. */ { struct sqlConnection *conn = hAllocConn(db); char maybeSplitTable[HDB_MAX_TABLE_STRING]; -if (!hFindSplitTable(db, NULL, table, maybeSplitTable, NULL)) - errAbort("hAnnoGetAutoSqlForDbTable: can't find table (or split table) for '%s.%s'", - db, table); +if (!hFindSplitTable(db, NULL, table, maybeSplitTable, sizeof maybeSplitTable, NULL)) + errAbort("hAnnoGetAutoSqlForDbTable: can't find table (or split table) for '%s.%s'", db, table); struct sqlFieldInfo *fieldList = sqlFieldInfoGet(conn, maybeSplitTable); struct asObject *asObj = NULL; if (tdb != NULL) asObj = asForTdb(conn, tdb); if (asObj == NULL) asObj = asFromTableDescriptions(conn, table); hFreeConn(&conn); if (columnsMatch(asObj, fieldList)) return asObj; else { // Special case for pgSnp, which includes its bin column in autoSql... struct asObject *pgSnpAsO = pgSnpAsObj(); if (columnsMatch(pgSnpAsO, fieldList)) return pgSnpAsO;