Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
JStringRef: ensure string is null terminated so c_str() works correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Dec 26, 2016
1 parent b5b0899 commit df7d326
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wpiutil/include/support/jni_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit df7d326

Please sign in to comment.