forked from github/server
missing nul-termination triggers valgrind.
This commit is contained in:
parent
2a0688d1b4
commit
8cc38420f0
1 changed files with 3 additions and 1 deletions
|
@ -58,6 +58,7 @@ static cJSON *export_a_region(CuTest * tc, const struct terrain_type *terrain, r
|
||||||
int err;
|
int err;
|
||||||
region *r;
|
region *r;
|
||||||
cJSON *json, *attr, *result, *regs;
|
cJSON *json, *attr, *result, *regs;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
r = test_create_region(0, 0, terrain);
|
r = test_create_region(0, 0, terrain);
|
||||||
|
|
||||||
|
@ -65,7 +66,8 @@ static cJSON *export_a_region(CuTest * tc, const struct terrain_type *terrain, r
|
||||||
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));
|
sz = out.api->read(out.handle, buf, sizeof(buf));
|
||||||
|
buf[sz] = '\0';
|
||||||
mstream_done(&out);
|
mstream_done(&out);
|
||||||
|
|
||||||
json = cJSON_Parse(buf);
|
json = cJSON_Parse(buf);
|
||||||
|
|
Loading…
Reference in a new issue