-#ifdef HAVE_LOCAL_SCAN
+#if (defined(HAVE_LOCAL_SCAN) || defined(EXPAND_DLFUNC)) \
+ && !defined(MACRO_PREDEF) && !defined(COMPILE_UTILITY)
/*************************************************
* Copy and save string *
*************************************************/
*/
uschar *
-string_copy_taint(const uschar * s, BOOL tainted)
+string_copy_taint_function(const uschar * s, BOOL tainted)
{
int len = Ustrlen(s) + 1;
uschar *ss = store_get(len, tainted);
*************************************************/
/* The formatting is done by string_vformat, which checks the length of
-everything.
+everything. Taint is taken from the worst of the arguments.
Arguments:
format a printf() format - deliberately char * rather than uschar *
uschar *
string_sprintf_trc(const char *format, const uschar * func, unsigned line, ...)
{
-gstring * g;
-va_list ap;
+#ifdef COMPILE_UTILITY
+uschar buffer[STRING_SPRINTF_BUFFER_SIZE];
+gstring gs = { .size = STRING_SPRINTF_BUFFER_SIZE, .ptr = 0, .s = buffer };
+gstring * g = &gs;
+unsigned flags = 0;
+#else
+gstring * g = NULL;
+unsigned flags = SVFMT_REBUFFER|SVFMT_EXTEND;
+#endif
+va_list ap;
va_start(ap, line);
-g = string_vformat_trc(NULL, func, line, STRING_SPRINTF_BUFFER_SIZE,
- SVFMT_REBUFFER|SVFMT_EXTEND, format, ap);
+g = string_vformat_trc(g, func, line, STRING_SPRINTF_BUFFER_SIZE,
+ flags, format, ap);
va_end(ap);
if (!g)
" called from %s %d\n",
STRING_SPRINTF_BUFFER_SIZE, format, func, line);
+#ifdef COMPILE_UTILITY
+return string_copyn(g->s, g->ptr);
+#else
gstring_release_unused(g);
return string_from_gstring(g);
+#endif
}
will not be grown, and is usable in the original place after return.
The return value can be NULL to signify overflow.
-Returns the possibly-new (if copy for growth was needed) string,
-not nul-terminated.
+Returns the possibly-new (if copy for growth or taint-handling was needed)
+string, not nul-terminated.
*/
gstring *