080a160c7b9595d516c9c70e83689a09b60839d0
galt
  Mon Jun 3 12:16:53 2013 -0700
fix SQL Injection
diff --git src/hg/hgTracks/pslTrack.c src/hg/hgTracks/pslTrack.c
index f6a0b51..e8a7a23 100644
--- src/hg/hgTracks/pslTrack.c
+++ src/hg/hgTracks/pslTrack.c
@@ -115,60 +115,60 @@
 		{
 		touppers(pattern);
 		hashAdd(hash, pattern, NULL);
 		freez(&pattern);
 		continue;
 		}
 
 	    /* Load up entire table looking for matches. */
 	    if (lastChar(pattern) != '*')
 		{
 		int len = strlen(pattern)+1;
 		pattern = needMoreMem(pattern, len, len+1);
 		pattern[len-1] = '*';
 		}
 	    anyWild = (strchr(pattern, '*') != NULL || strchr(pattern, '?') != NULL);
-	    sprintf(query, "select id,name from %s", fil->table);
+	    sqlSafef(query, sizeof query, "select id,name from %s", fil->table);
 	    touppers(pattern);
 	    sr = sqlGetResult(conn, query);
 	    while ((row = sqlNextRow(sr)) != NULL)
 		{
 		boolean gotMatch;
 		touppers(row[1]);
 		if (anyWild)
 		    gotMatch = wildMatch(pattern, row[1]);
 		else
 		    gotMatch = sameString(pattern, row[1]);
 		if (gotMatch)
 		    {
 		    hashAdd(hash, row[0], NULL);
 		    }
 		}
 	    sqlFreeResult(&sr);
 	    freez(&pattern);
 	    }
 	freez(&dupPat);
 	}
     }
 
 /* Scan through linked features coloring and or including/excluding ones that
  * match filter. */
 for (lf = *pLfList; lf != NULL; lf = next)
     {
     boolean passed = andLogic;
     next = lf->next;
-    sprintf(query, "select * from gbCdnaInfo where acc = '%s'", lf->name);
+    sqlSafef(query, sizeof query, "select * from gbCdnaInfo where acc = '%s'", lf->name);
     sr = sqlGetResult(conn, query);
     if ((row = sqlNextRow(sr)) != NULL)
 	{
 	for (fil = mud->filterList; fil != NULL; fil = fil->next)
 	    {
 	    if (fil->hash != NULL)
 		{
 		if (hashLookup(fil->hash, row[fil->mrnaTableIx]) == NULL)
 		    {
 		    if (andLogic)
 			passed = FALSE;
 		    }
 		else
 		    {
 		    if (!andLogic)
@@ -335,35 +335,35 @@
 boolean isSelected(char *seqId)
 {
 char query[256];
 struct sqlResult *sr;
 char **row;
 char *subjId, *testSubjId;
 struct sqlConnection *conn;
 struct gsidSubj *subj;
 
 if (!gsidSelectedSubjListLoaded) initializeGsidSubjList();
 
 conn= hAllocConn(database);
 
 if (hIsGsidServer())
     {
-    sprintf(query,"select subjId from gsIdXref where dnaSeqId='%s'", seqId);
+    sqlSafef(query, sizeof query, "select subjId from gsIdXref where dnaSeqId='%s'", seqId);
     }
 else
     {
-    sprintf(query,"select subjId from gisaidXref where dnaSeqId='%s'", seqId);
+    sqlSafef(query, sizeof query, "select subjId from gisaidXref where dnaSeqId='%s'", seqId);
     }
 sr = sqlMustGetResult(conn, query);
 row = sqlNextRow(sr);
 if (row != NULL)
     {
     subjId = row[0];
 
     /* scan thru subj ID list */
     subj = gsidSelectedSubjList;
     while (subj != NULL)
     	{
     	testSubjId = subj->subjId;
 	if (sameWord(subjId, testSubjId))
 	    {
 	    sqlFreeResult(&sr);