f20cd920ff7ce99900b2f8350ca4b30948d47af2 galt Wed Jul 22 11:36:29 2015 -0700 Fixes RM#15751. Fixes a minor problem with sql string escaping. Also added a new function sqlSafefAppend because it use handy when you need to safely append a little formatted string, but you do not want to be bothered with using dyStrings. diff --git src/hg/inc/jksql.h src/hg/inc/jksql.h index 1d5aa67..f77efe9 100644 --- src/hg/inc/jksql.h +++ src/hg/inc/jksql.h @@ -631,30 +631,43 @@ * the entire sql string. */ int sqlSafefFrag(char* buffer, int bufSize, char *format, ...) /* Format 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 just a fragment of * the entire sql string. */ #ifdef __GNUC__ __attribute__((format(printf, 3, 4))) #endif ; +int sqlSafefAppend(char* buffer, int bufSize, char *format, ...) +/* 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. */ 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. */ 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. */ #ifdef __GNUC__