forked from github/server
fix json test (null-terminate read)
This commit is contained in:
parent
8912a59ac4
commit
93cdec9ddc
|
@ -35,12 +35,14 @@ static void test_export_no_regions(CuTest * tc) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
stream out = { 0 };
|
stream out = { 0 };
|
||||||
int err;
|
int err;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
mstream_init(&out);
|
mstream_init(&out);
|
||||||
err = json_export(&out, EXPORT_REGIONS);
|
err = json_export(&out, EXPORT_REGIONS);
|
||||||
CuAssertIntEquals(tc, 0, err);
|
CuAssertIntEquals(tc, 0, err);
|
||||||
out.api->rewind(out.handle);
|
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));
|
CuAssertStrEquals(tc, "{}", strip(buf));
|
||||||
mstream_done(&out);
|
mstream_done(&out);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue