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/hgGene/hgGene.c src/hg/hgGene/hgGene.c
index 3f28fd6..8457b94 100644
--- src/hg/hgGene/hgGene.c
+++ src/hg/hgGene/hgGene.c
@@ -642,37 +642,38 @@
 if (row != NULL)
     {
     curGeneChrom = cloneString(row[0]);
     curGeneStart = atoi(row[1]);
     curGeneEnd = atoi(row[2]);
     }
 else
     hUserAbort("Couldn't find %s in %s.%s", curGeneId, database, table);
 sqlFreeResult(&sr);
 }
 
 static struct genePred *getCurGenePred(struct sqlConnection *conn)
 /* Return current gene in genePred. */
 {
 char *track = genomeSetting("knownGene");
-char table[64];
+char table[HDB_MAX_TABLE_STRING];
 boolean hasBin;
 char query[256];
 struct sqlResult *sr;
 char **row;
 struct genePred *gp = NULL;
-hFindSplitTable(sqlGetDatabase(conn), curGeneChrom, track, table, &hasBin);
+if (!hFindSplitTable(sqlGetDatabase(conn), curGeneChrom, track, table, sizeof table, &hasBin))
+    errAbort("track %s not found", track);
 bool hasAttrId = sqlColumnExists(conn, table, "alignId");
 sqlSafef(query, sizeof(query),
 	"select * from %s where name = '%s' "
 	"and chrom = '%s' and txStart=%d and txEnd=%d"
 	, table, curGeneId, curGeneChrom, curGeneStart, curGeneEnd);
 sr = sqlGetResult(conn, query);
 if ((row = sqlNextRow(sr)) != NULL)
     {
     gp = genePredLoad(row + hasBin);
 
 #define  ALIGNIDFIELD      11  // Gencode Id
     if (hasAttrId)
 	curAlignId = cloneString(row[ALIGNIDFIELD]);
     else
 	curAlignId = gp->name;