diff --git a/src/string.cpp b/src/string.cpp --- a/src/string.cpp +++ b/src/string.cpp @@ -120,9 +120,9 @@ char *strecpy(char *dst, const char *src if (dst == last && *src != '\0') { #if defined(STRGEN) || defined(SETTINGSGEN) - error("String too long for destination buffer"); + error("String too long for destination buffer: %s", src); #else /* STRGEN || SETTINGSGEN */ - Debug(misc, 0, "String too long for destination buffer"); + Debug(misc, 0, "String too long for destination buffer: {}", src); #endif /* STRGEN || SETTINGSGEN */ } return dst; @@ -143,6 +143,16 @@ char *stredup(const char *s, const char return tmp; } +char *str_vfmt(const char *str, va_list va) +{ + char buf[4096]; + + int len = vseprintf(buf, lastof(buf), str, va); + char *p = MallocT(len + 1); + memcpy(p, buf, len + 1); + return p; +} + /** * Format, "printf", into a newly allocated string. * @param str The formatting string.