1f55f129858863d78076fd3818d3841429741121 galt Mon Jan 29 01:35:45 2018 -0800 Fixing bug: sqlDyStringAppend() is not safe, and it is not needed. Using sqlDyStringPrintf instead. diff --git src/hg/inc/jksql.h src/hg/inc/jksql.h index 6299dca..615749d 100644 --- src/hg/inc/jksql.h +++ src/hg/inc/jksql.h @@ -680,68 +680,67 @@ /* Append formatted string to buffer, vsprintf style, only with buffer overflow * checking. The resulting string is always terminated with zero byte. * Scans unquoted string parameters for illegal literal sql chars. * Escapes quoted string parameters. * NOSLQINJ tag is NOT added to beginning since it is assumed to be appended to * a properly created sql string. */ #ifdef __GNUC__ __attribute__((format(printf, 3, 4))) #endif ; void vaSqlDyStringPrintfExt(struct dyString *ds, boolean isFrag, char *format, va_list args); /* VarArgs Printf to end of dyString after scanning string parameters for illegal sql chars. * Strings inside quotes are automatically escaped. - * NOSLQINJ tag is added to beginning if it is a new empty string and isFrag is FALSE. */ + * NOSLQINJ tag is added to beginning if it is a new empty string and isFrag is FALSE. + * Appends to existing string. */ void vaSqlDyStringPrintf(struct dyString *ds, char *format, va_list args); /* Printf to end of dyString after scanning string parameters for illegal sql chars. * Strings inside quotes are automatically escaped. - * NOSLQINJ tag is added to beginning if it is a new empty string. */ + * NOSLQINJ tag is added to beginning if it is a new empty string. + * Appends to existing string. */ void sqlDyStringPrintf(struct dyString *ds, char *format, ...) /* Printf to end of dyString after scanning string parameters for illegal sql chars. * Strings inside quotes are automatically escaped. - * NOSLQINJ tag is added to beginning if it is a new empty string. */ + * NOSLQINJ tag is added to beginning if it is a new empty string. + * Appends to existing string. */ #ifdef __GNUC__ __attribute__((format(printf, 2, 3))) #endif ; void vaSqlDyStringPrintfFrag(struct dyString *ds, char *format, va_list args); /* VarArgs Printf to end of dyString after scanning string parameters for illegal sql chars. * Strings inside quotes are automatically escaped. * NOSLQINJ tag is NOT added to beginning since it is assumed to be just a fragment of - * the entire sql string. */ + * the entire sql string. Appends to existing string. */ void sqlDyStringPrintfFrag(struct dyString *ds, char *format, ...) /* Printf to end of dyString after scanning string parameters for illegal sql chars. * Strings inside quotes are automatically escaped. * NOSLQINJ tag is NOT added to beginning since it is assumed to be just a fragment of - * the entire sql string. */ + * the entire sql string. Appends to existing string. */ #ifdef __GNUC__ __attribute__((format(printf, 2, 3))) #endif ; #define NOSQLINJ "NOSQLINJ " -void sqlDyStringAppend(struct dyString *ds, char *string); -/* Append zero terminated string to end of dyString. - * Adds the NOSQLINJ prefix if dy string is empty. */ - struct dyString *sqlDyStringCreate(char *format, ...) /* Create a dyString with a printf style initial content * Adds the NOSQLINJ prefix. */ #ifdef __GNUC__ __attribute__((format(printf, 1, 2))) #endif ; void sqlCheckError(char *format, ...) /* A sql injection error has occurred. Check for settings and respond * as appropriate with error, warning, logOnly, ignore, dumpstack. * Then abort if needed. NOTE: unless it aborts, this function will return! */ #ifdef __GNUC__ __attribute__((format(printf, 1, 2))) #endif