forked from github/server
Merge pull request #51 from badgerman/master
fix json test (null-terminate read)
This commit is contained in:
commit
6f0773a15f
1 changed files with 3 additions and 1 deletions
|
@ -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 a new issue