Re: [PATCH] Add compat/vsnprintf.c for systems that returns -1 on maxsize reached
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Mar 4, 2008, 16:28 UTC
- Message-ID
- <47CD78C9.80003@viscovery.net>
- In-Reply-To
- <200803041459.29000.michal.rokos@nextsoft.cz>
Michal Rokos schrieb:
> If anybody could think of some better define than BROKEN_VSNPRINTF, I'm all > ears.
CLUELESS_OVERFLOWN_VSNPRINTF?
Because we have the same issue on Windows where vsnprintf returns -1 on overflow.
But there is also another complication: The size parameter of the system's vsnprintf must not count the trailing NUL, i.e. the buffer must actually have space for one extra byte, whereas the POSIX version must count NUL. Can you check whether your vsnprintf has this flaw, too? If it doesn't, we would need another configuration variable so that we can distinguish these two kinds of brokenness.
-- Hannes