| 29 | namespace analysis_plugin::elf { |
| 30 | |
| 31 | std::string is_string(LIEF::SpanStream& stream, size_t minsz = 4) { |
| 32 | std::string current; |
| 33 | while (stream) { |
| 34 | auto c = stream.read<uint8_t>(); |
| 35 | if (!c) { |
| 36 | break; |
| 37 | } |
| 38 | |
| 39 | // Terminator |
| 40 | if (*c == '\0') { |
| 41 | if (current.size() >= minsz) { |
| 42 | return current; |
| 43 | } |
| 44 | return ""; |
| 45 | } |
| 46 | |
| 47 | // Valid char |
| 48 | if (std::isprint(*c) == 0) { |
| 49 | return ""; |
| 50 | } |
| 51 | |
| 52 | current.push_back((char)*c); |
| 53 | } |
| 54 | return ""; |
| 55 | } |
| 56 | |
| 57 | AnalyzerBase::AnalyzerBase(BinaryNinja::BinaryView& bv, Binary& elf, |
| 58 | TypeBuilder& type_builder) : |
no test coverage detected