JStringRef: ensure string is null terminated so c_str() works correctly.

This commit is contained in:
Peter Johnson
2016-12-26 14:13:15 -08:00
parent 95ad4783f1
commit e3f99a4a22

View File

@@ -115,6 +115,9 @@ class JStringRef {
llvm::errs() << "JStringRef was passed a null pointer at \n"
<< GetJavaStackTrace(env);
}
// Ensure str is null-terminated.
m_str.push_back('\0');
m_str.pop_back();
}
operator llvm::StringRef() const { return m_str; }