From 93cdec9ddc28af5c780d6b790541abdd8ed4002d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 4 Nov 2014 07:57:29 +0100 Subject: [PATCH] fix json test (null-terminate read) --- src/json.test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/json.test.c b/src/json.test.c index 73524f2e8..5b3f9813e 100644 --- a/src/json.test.c +++ b/src/json.test.c @@ -35,12 +35,14 @@ static void test_export_no_regions(CuTest * tc) { char buf[1024]; stream out = { 0 }; int err; + size_t len; mstream_init(&out); err = json_export(&out, EXPORT_REGIONS); CuAssertIntEquals(tc, 0, err); out.api->rewind(out.handle); - out.api->read(out.handle, buf, sizeof(buf)); + len = out.api->read(out.handle, buf, sizeof(buf)); + buf[len] = '\0'; CuAssertStrEquals(tc, "{}", strip(buf)); mstream_done(&out); }