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/hgc/regMotif.c src/hg/hgc/regMotif.c index b089c35..6691df3 100644 --- src/hg/hgc/regMotif.c +++ src/hg/hgc/regMotif.c @@ -217,38 +217,39 @@ reverseComplement(seq->dna, seq->size); } motifHitSection(seq, motif); printTrackHtml(tdb); } void doFlyreg(struct trackDb *tdb, char *item) /* flyreg.org: Drosophila DNase I Footprint db. */ { struct dyString *query = newDyString(256); struct sqlConnection *conn = hAllocConn(database); struct sqlResult *sr = NULL; char **row; int start = cartInt(cart, "o"); int end = cartInt(cart, "t"); -char fullTable[64]; +char fullTable[HDB_MAX_TABLE_STRING]; boolean hasBin = FALSE; char *motifTable = "flyregMotif"; struct dnaMotif *motif = NULL; boolean isVersion2 = sameString(tdb->table, "flyreg2"); genericHeader(tdb, item); -hFindSplitTable(database, seqName, tdb->table, fullTable, &hasBin); +if (!hFindSplitTable(database, seqName, tdb->table, fullTable, sizeof fullTable, &hasBin)) + errAbort("track %s not found", tdb->table); sqlDyStringPrintf(query, "select * from %s where chrom = '%s' and ", fullTable, seqName); hAddBinToQuery(start, end, query); sqlDyStringPrintf(query, "chromStart = %d and name = '%s'", start, item); sr = sqlGetResult(conn, query->string); if ((row = sqlNextRow(sr)) != NULL) { struct flyreg2 fr; if (isVersion2) flyreg2StaticLoad(row+hasBin, &fr); else flyregStaticLoad(row+hasBin, (struct flyreg *)(&fr)); printf("Factor: %s
\n", fr.name); printf("Target: %s
\n", fr.target); if (isVersion2)