diff options
Diffstat (limited to 'tools/aapt2')
-rw-r--r-- | tools/aapt2/Util.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/aapt2/Util.cpp b/tools/aapt2/Util.cpp index 03ecd1a..5b064e3 100644 --- a/tools/aapt2/Util.cpp +++ b/tools/aapt2/Util.cpp @@ -303,8 +303,10 @@ std::string utf16ToUtf8(const StringPiece16& utf16) { } std::string utf8; + // Make room for '\0' explicitly. + utf8.resize(utf8Length + 1); + utf16_to_utf8(utf16.data(), utf16.length(), &*utf8.begin(), utf8Length + 1); utf8.resize(utf8Length); - utf16_to_utf8(utf16.data(), utf16.length(), &*utf8.begin()); return utf8; } |