diff options
Diffstat (limited to 'examples/c-json-stdout/c-json-stdout.c')
-rw-r--r-- | examples/c-json-stdout/c-json-stdout.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/c-json-stdout/c-json-stdout.c b/examples/c-json-stdout/c-json-stdout.c index b70d7bac5..015bc99fe 100644 --- a/examples/c-json-stdout/c-json-stdout.c +++ b/examples/c-json-stdout/c-json-stdout.c @@ -90,7 +90,8 @@ int main(void) break; } - if (buf[json_bytes - 1] != '}') + if (buf[json_bytes - 2] != '}' || + buf[json_bytes - 1] != '\n') { fprintf(stderr, "BUG: Invalid JSON string: %.*s\n", (int)json_bytes, buf); exit(1); |