Browse Source

Merge pull request #748 from c3h2-ctf/printbuf

sprintbuf(): test for all vsnprintf error values
tags/json-c-0.16-20220414
Eric Hawicz GitHub 3 years ago
parent
commit
f0d93cee14
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      printbuf.c

+ 1
- 1
printbuf.c View File

@@ -145,7 +145,7 @@ int sprintbuf(struct printbuf *p, const char *msg, ...)
* if output is truncated whereas some return the number of bytes that
* would have been written - this code handles both cases.
*/
if (size == -1 || size > 127)
if (size < 0 || size > 127)
{
va_start(ap, msg);
if ((size = vasprintf(&t, msg, ap)) < 0)


Loading…
Cancel
Save