Skip to content

Commit

Permalink
chore: make GetCStrings func work w/ in-cache dylibs as well
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Aug 8, 2024
1 parent 5dc2e9c commit c4f8bca
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c4f8bca

Please # to comment.