mirror of
https://github.com/json-c/json-c.git
synced 2026-04-07 14:29:06 +08:00
Merge pull request #748 from c3h2-ctf/printbuf
sprintbuf(): test for all vsnprintf error values
This commit is contained in:
@@ -145,7 +145,7 @@ int sprintbuf(struct printbuf *p, const char *msg, ...)
|
|||||||
* if output is truncated whereas some return the number of bytes that
|
* if output is truncated whereas some return the number of bytes that
|
||||||
* would have been written - this code handles both cases.
|
* would have been written - this code handles both cases.
|
||||||
*/
|
*/
|
||||||
if (size == -1 || size > 127)
|
if (size < 0 || size > 127)
|
||||||
{
|
{
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
if ((size = vasprintf(&t, msg, ap)) < 0)
|
if ((size = vasprintf(&t, msg, ap)) < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user