mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Binary: skips short string entirely to improve performance
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -72,6 +72,7 @@ static bool handleMachSection(const FFMemoryMapping* mapping, const char* name,
|
||||
}
|
||||
uint32_t len = (uint32_t) strnlen(p, size - off);
|
||||
if (len < minLength) {
|
||||
off += len; // Skip short strings
|
||||
continue;
|
||||
}
|
||||
if (*p >= ' ' && *p <= '~') { // Ignore control characters
|
||||
@@ -177,8 +178,6 @@ static const char* dumpMachHeader(const FFMemoryMapping* mapping, off_t offset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -112,8 +112,9 @@ const char* ffBinaryExtractStrings(const char* elfFile, bool (*cb)(const char* s
|
||||
if (*p == '\0') {
|
||||
continue;
|
||||
}
|
||||
uint32_t len = (uint32_t) strlen(p);
|
||||
uint32_t len = (uint32_t) strnlen(p, data->d_size - off);
|
||||
if (len < minLength) {
|
||||
off += len;
|
||||
continue;
|
||||
}
|
||||
// Only process printable ASCII characters
|
||||
|
||||
@@ -49,8 +49,9 @@ const char* ffBinaryExtractStrings(const char* peFile, bool (*cb)(const char* st
|
||||
if (*p == '\0') {
|
||||
continue;
|
||||
}
|
||||
uint32_t len = (uint32_t) strlen(p);
|
||||
uint32_t len = (uint32_t) strnlen(p, section->SizeOfRawData - off);
|
||||
if (len < minLength) {
|
||||
off += len;
|
||||
continue;
|
||||
}
|
||||
// Only process printable ASCII characters
|
||||
|
||||
Reference in New Issue
Block a user