Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 091430bd authored by Chris Weir's avatar Chris Weir
Browse files

Fix sanitizer error

Wrong constructor for string is being used, which sometimes causes a
sanitizer error, due to read past the end of buff, which wasn't NUL-terminated.

Bug: 263769296
Test: m, it runs
Change-Id: I97c00d5ae068a18739c313eeae39ab6454266a23
parent f4ff5871
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ static std::optional<std::string> readString(std::istream& s, std::streamsize n)
    char buff[n];
    auto got = s.read(buff, n).gcount();
    if (!s.good() && !s.eof()) return std::nullopt;
    return std::string(buff, 0, std::min(n, got));
    return std::string(buff, got);
}

std::optional<CanBusConfig> parseConfigFile(const std::string& filepath) {