in v2/src/get_thread_stack.c [55:84]
static void snprintf_fallback_impl(char** destination, size_t* destination_size, const char* fallback_string, size_t fallbackstring_size, const char* format, ...)
{
va_list args;
va_start(args, format);
int snprintfResult;
/*trying to complain*/
snprintfResult = vsnprintf(*destination, *destination_size, format, args);
if (!(
(snprintfResult >= 0) && /*the returned value is nonnegative [...]*/
(snprintfResult < (int)(*destination_size)) /*[...] and less than n.*/
))
{
/*complain about not being able to complain - only copy the part of the fallback string that fits*/
size_t size_to_copy = *destination_size < fallbackstring_size ? *destination_size : fallbackstring_size - 1;
(void)memcpy(*destination, fallback_string, size_to_copy);
(*destination) += size_to_copy;
(*destination_size) -= size_to_copy;
}
else
{
/*complain*/
(*destination) += snprintfResult;
(*destination_size) -= snprintfResult;
}
va_end(args);
}