44ccfacbe3a3d4b300f80d48651c77837a4b571e
galt
  Tue Apr 26 11:12:02 2022 -0700
SQL INJECTION Prevention Version 2 - this improves our methods by making subclauses of SQL that get passed around be both easy and correct to use. The way that was achieved was by getting rid of the obscure and not well used functions sqlSafefFrag and sqlDyStringPrintfFrag and replacing them with the plain versions of those functions, since these are not needed anymore. The new version checks for NOSQLINJ in unquoted %-s which is used to include SQL clauses, and will give an error the NOSQLINJ clause is not present, and this will automatically require the correct behavior by developers. sqlDyStringPrint is a very useful function, however because it was not enforced, users could use various other dyString functions and they operated without any awareness or checking for SQL correct use. Now those dyString functions are prohibited and it will produce an error if you try to use a dyString function on a SQL string, which is simply detected by the presence of the NOSQLINJ prefix.

diff --git src/hg/synMap/runSlam.c src/hg/synMap/runSlam.c
index b5d66c3..702ae3e 100644
--- src/hg/synMap/runSlam.c
+++ src/hg/synMap/runSlam.c
@@ -273,46 +273,46 @@
 /* Add a dummy fasta record so that avid will order and orient things for us.. */
 if(addDummy)
     faWriteNext(faOut, "garbage", "nnnnnnnnnn", 10);
 carefulClose(&faOut);
 /** This bit is commented out as we are now using nnnn's as repeat masking */
 /*  if(slCount(gbList) > 1) */
 /*      repeatMaskFile(outputRoot, gbList); */
 /*  else */
 /*    fakeRepeatMaskFile(outputRoot, gbList); */
 freez(&faFile);
 }
 
 void touchFile(char *root, char *suffix)
 /* same functionality as the "touch" unix command. */
 {
-struct dyString *file = newDyString(2048);
+struct dyString *file = dyStringNew(2048);
 FILE *touch = NULL;
 dyStringPrintf(file, "%s%s", root, suffix);
 touch = mustOpen(file->string, "w");
 carefulClose(&touch);
 dyStringFree(&file);
 }
 
 void runSlamExe(char *outputDir, struct genomeBit *target, struct genomeBit *aligns, char *refPrefix, char *alignPrefix)
 /* run the actual slam program */
 {
 char *fa1 = NULL;
 char *fa2 = NULL;
 char *gff1 = NULL;
 char *gff2 = NULL;
-struct dyString *dy = newDyString(1024);
+struct dyString *dy = dyStringNew(1024);
 
 char command[2048];
 int retVal = 0;
 /* get our arguments */
 fa1 = fileNameFromGenomeBit("", ".fa", target);
 fa2 = fileNameFromGenomeBit("", ".fa", aligns);
 gff1 = fileNameFromGenomeBit("", "", target);
 gff2 = fileNameFromGenomeBit("", "", aligns);
 
 if(runAvidFirst)
     {
     struct dnaSeq *faMerged = NULL, *fa = NULL;
     int bpCount = 0;
     snprintf(command, sizeof(command), "%savid -nm=both  %s %s",
 	       slamBin, fa1, fa2);