8d6c643aa40c23a81cbc16fe0961e78e61b1e5f4 galt Mon May 30 23:44:54 2022 -0700 Fixing problem in logOnly and other non-abort modes for NOSQLINJv2. diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c index de8d383..c83f51d 100644 --- src/hg/lib/jksql.c +++ src/hg/lib/jksql.c @@ -4110,42 +4110,46 @@ else if (c == 'p') { va_arg(args, void *); } // char get promoted to int by varargs process else if (c == 'c') { va_arg(args, int); } // finally, the string we care about! else if (c == 's') { char *s = va_arg(args, char *); if (s == NULL) sqlCheckError("%%s value is NULL which is incorrect."); if (quote == 0) { // check identifier if (!isNegated) // Not a Pre-escaped String sqlCheckIdentifier(s); else { - if (!startsWith(NOSQLINJ, s)) + if (startsWith(NOSQLINJ, s)) { - sqlCheckError("Internal Error: Input to %%-s should be created with safe functions."); - } // wipe out the prefix by removing from the input string s int strLen = strlen(s); memmove(s, s+NOSQLINJ_SIZE, strLen - NOSQLINJ_SIZE + 1); AllocVar(restoreSafeStr); restoreSafeStr->s = s; restoreSafeStr->strLen = strLen; slAddHead(&restoreSafeStrList, restoreSafeStr); } + else + { + sqlCheckError("Internal Error: Input to %%-s should be created with safe functions."); + // will continue here if non-abort level chosen. + } + } } else { // check quoted literal if (!isNegated) // Not a Pre-escaped String { // go back and insert escPunc before the leading % char saved in lastPct // move the accumulated %s descriptor memmove(lastPct+1, lastPct, nf - lastPct); // this is typically very small, src and dest overlap. ++nf; *lastPct = escPunc; *nf++ = escPunc; ++escStringsCount; if (s == NULL) { escStringsSize += strlen("(null)");