080a160c7b9595d516c9c70e83689a09b60839d0 galt Mon Jun 3 12:16:53 2013 -0700 fix SQL Injection diff --git src/hg/hgc/txCdsInfo.c src/hg/hgc/txCdsInfo.c index 0e57c03..2166bc8 100644 --- src/hg/hgc/txCdsInfo.c +++ src/hg/hgc/txCdsInfo.c @@ -5,31 +5,31 @@ #include "hdb.h" #include "web.h" #include "cdsEvidence.h" #include "txInfo.h" #include "trackDb.h" #include "hgc.h" void showTxInfo(char *geneName, struct trackDb *tdb, char *txInfoTable) /* Print out stuff from txInfo table. */ { struct sqlConnection *conn = hAllocConn(database); if (sqlTableExists(conn, txInfoTable)) { char query[512]; - safef(query, sizeof(query), "select * from %s where name='%s'", txInfoTable, geneName); + sqlSafef(query, sizeof(query), "select * from %s where name='%s'", txInfoTable, geneName); struct sqlResult *sr = sqlGetResult(conn, query); char **row; if ((row = sqlNextRow(sr)) != NULL) { struct txInfo *info = txInfoLoad(row); webNewSection("Transcript Information"); webPrintLinkTableStart(); webPrintLinkCell("category:"); webPrintLinkCell(info->category); webPrintLinkCell("nonsense-mediated-decay:"); webPrintLinkCell(info->nonsenseMediatedDecay ? "yes" : "no"); webPrintLinkCell("RNA accession:"); webPrintLinkCell(info->sourceAcc); webPrintLinkTableNewRow(); @@ -189,35 +189,35 @@ "
  • # of strange splices - The number of introns that have ends which are\n" "neither GT/AG, GC/AG, nor AT/AC. Many of these are the result of sequencing\n" "errors, or polymorphisms between the DNA donors and the RNA donors.
  • \n" "\n"); } void showCdsEvidence(char *geneName, struct trackDb *tdb, char *evTable) /* Print out stuff from cdsEvidence table. */ { struct sqlConnection *conn = hAllocConn(database); double bestScore = 0; if (sqlTableExists(conn, evTable)) { webNewSection("CDS Prediction Information"); char query[512]; - safef(query, sizeof(query), + sqlSafef(query, sizeof(query), "select count(*) from %s where name='%s'", evTable, geneName); if (sqlQuickNum(conn, query) > 0) { - safef(query, sizeof(query), + sqlSafef(query, sizeof(query), "select * from %s where name='%s' order by score desc", evTable, geneName); struct sqlResult *sr = sqlGetResult(conn, query); char **row; webPrintLinkTableStart(); webPrintLabelCell("ORF
    size"); webPrintLabelCell("start in
    transcript"); webPrintLabelCell("end in
    transcript"); webPrintLabelCell("source"); webPrintLabelCell("accession"); webPrintLabelCell("ad-hoc
    score"); webPrintLabelCell("start
    codon"); webPrintLabelCell("end
    codon"); webPrintLabelCell("piece
    count"); webPrintLabelCell("piece list");