MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ExtractString

Function ExtractString

src/fileio.cpp:435–438  ·  view source on GitHub ↗

* Helper to extract a string for the tar header. We must assume that the tar * header contains garbage and is malicious. So, we cannot rely on the string * being properly terminated. * As such, do not use strlen to determine the actual length (explicitly or * implicitly via the std::string constructor), but pass the buffer bounds * explicitly. * @param buffer The buffer to read from. * @ret

Source from the content-addressed store, hash-verified

433 * @return The string data.
434 */
435static std::string ExtractString(std::span<char> buffer)
436{
437 return StrMakeValid(std::string_view(buffer.begin(), buffer.end()));
438}
439
440bool TarScanner::AddFile(const std::string &filename, size_t, [[maybe_unused]] const std::string &tar_filename)
441{

Callers 1

AddFileMethod · 0.85

Calls 3

StrMakeValidFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected