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/inc/dystring.h src/inc/dystring.h
index 18dc0a7..ef94c3f 100644
--- src/inc/dystring.h
+++ src/inc/dystring.h
@@ -6,45 +6,41 @@
 #ifndef DYSTRING_H	/* Wrapper to avoid including this twice. */
 #define DYSTRING_H
 
 #include "common.h"
 
 struct dyString
 /* Dynamically resizable string that you can do formatted
  * output to. */
     {
     struct dyString *next;	/* Next in list. */
     char *string;		/* Current buffer. */
     long bufSize;		/* Size of buffer. */
     long stringSize;		/* Size of string. */
     };
 
+#define dyStringNew newDyString
+
 struct dyString *newDyString(long initialBufSize);
 /* Allocate dynamic string with initial buffer size.  (Pass zero for default) */
 
-#define dyStringNew newDyString
-
-void freeDyString(struct dyString **pDs);
+void dyStringFree(struct dyString **pDs);
 /* Free up dynamic string. */
 
-#define dyStringFree(a) freeDyString(a);
-
-void freeDyStringList(struct dyString **pDs);
+void dyStringListFree(struct dyString **pDs);
 /* Free up a list of dynamic strings */
 
-#define dyStringFreeList(a) freeDyStringList(a);
-
 void dyStringAppend(struct dyString *ds, char *string);
 /* Append zero terminated string to end of dyString. */
 
 void dyStringAppendN(struct dyString *ds, char *string, long stringSize);
 /* Append string of given size to end of string. */
 
 char dyStringAppendC(struct dyString *ds, char c);
 /* Append char to end of string. */
 
 void dyStringAppendMultiC(struct dyString *ds, char c, int n);
 /* Append N copies of char to end of string. */
 
 void dyStringAppendEscapeQuotes(struct dyString *dy, char *string,
 	char quot, char esc);
 /* Append escaped-for-quotation version of string to dy. */