init readbuffer with 0-token.

pull/2966/head
Kim Kulling 2020-09-30 11:57:29 +02:00 committed by GitHub
parent b4f79411aa
commit ea741fd8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -122,8 +122,11 @@ public:
} }
bool result = false; bool result = false;
mData.resize(stream->FileSize()); const size_t len = stream->FileSize();
stream->Read(&mData[0], mData.size(), 1); mData.resize(len + 1);
memset(&mData[0], '\0', len + 1);
stream->Read(&mData[0], 1, len);
mDoc = new pugi::xml_document(); mDoc = new pugi::xml_document();
pugi::xml_parse_result parse_result = mDoc->load_string(&mData[0], pugi::parse_full); pugi::xml_parse_result parse_result = mDoc->load_string(&mData[0], pugi::parse_full);
if (parse_result.status == pugi::status_ok) { if (parse_result.status == pugi::status_ok) {