Skip to content

Commit

Permalink
fix: issue where last item in file cat-ed to ipsw dsc str command w…
Browse files Browse the repository at this point in the history
…asn't parsed
  • Loading branch information
blacktop committed Jul 16, 2024
1 parent 1c0273b commit 730b480
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/ipsw/cmd/dyld/dyld_str.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ var StrSearchCmd = &cobra.Command{
return err
}
} else {
log.Info("Searching for strings...")
var searchStrings []string

if len(args) > 1 {
Expand All @@ -125,19 +124,22 @@ var StrSearchCmd = &cobra.Command{
for {
part, err := reader.ReadString('\n')
if err == io.EOF {
if len(part) > 0 {
inputBuilder.WriteString(part)
}
break
}
if err != nil {
return fmt.Errorf("failed to read from stdin: %v", err)
}
inputBuilder.WriteString(strings.TrimSuffix(part, "\n"))
inputBuilder.WriteString(part)
}
searchStrings = strings.Split(inputBuilder.String(), " ")
searchStrings = strings.Split(inputBuilder.String(), "\n")
} else {
return fmt.Errorf("no input provided via stdin")
}
}

log.Infof("Searching for strings: %s", strings.Join(searchStrings, ", "))
strs, err = dscCmd.GetStrings(f, searchStrings...)
if err != nil {
return err
Expand Down

0 comments on commit 730b480

Please sign in to comment.