Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unterminated string causing flaky behavior.
Fixes shorebirdtech/shorebird#235 The root cause was we were not terminating the strings passed for original_libapp_paths. We used a Vector<char> but didn't append a '\0' to the end before calling data(), so when the c/rust side walked to find the end of the char* it sometimes found extra characters at the end of the string unexpectedly. This fixes to use a shorter (but probably equally dangerous?) method of using c_str() which we had tried before but previously had used c_str() on a temporary. This attempt carefully uses a reference to the string so the c_str()'s lifetime is tied to the string in application_library_paths rather than a temporary copy. This is still slightly dangerous in that c_str() lives as long as a std::string does, so long as it's not modified.
- Loading branch information