All sizes passed to vsprintf() greater than INT_MAX are invalid; that's
what the original code is testing, warning, and handling correctly.
Andrew was commenting that this was the only additional information you
provided instead of showing a working example.
That's buggy because len may be greater than sizeof(buf). snprintf()
returns the number of characters that would have been generated if it
wasn't truncated so that we can test that value upon return.
Right, that's the behavior of snprintf(), but that doesn't mean the passed
size can be anything larger than INT_MAX.
No, it shouldn't, these functions return int. INT_MAX is the largest
value we can handle successfully and that's why it is the special case for
sprintf() and vsprintf().
The code as it stands is correct not because of the type of the size but
rather the type of the return value.
--