From c4f8bca01ab2630cdf3b4c0f8314c6d8a73bf4d7 Mon Sep 17 00:00:00 2001 From: blacktop Date: Thu, 8 Aug 2024 17:20:40 -0600 Subject: [PATCH] chore: make GetCStrings func work w/ in-cache dylibs as well --- file.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/file.go b/file.go index 9f8a8f6..5a6a5db 100644 --- a/file.go +++ b/file.go @@ -1651,14 +1651,10 @@ func (f *File) GetCStrings() (map[string]map[string]uint64, error) { for _, sec := range f.Sections { if sec.Flags.IsCstringLiterals() || sec.Name == "__os_log" { - off, err := f.GetOffset(sec.Addr) - if err != nil { - return nil, fmt.Errorf("failed to get offset for %s.%s: %v", sec.Seg, sec.Name, err) - } + f.cr.SeekToAddr(sec.Addr) dat := make([]byte, sec.Size) - if _, err = f.ReadAt(dat, int64(off)); err != nil { + if _, err := f.cr.Read(dat); err != nil { return nil, fmt.Errorf("failed to read cstring data in %s.%s: %v", sec.Seg, sec.Name, err) - } section := fmt.Sprintf("%s.%s", sec.Seg, sec.Name)