Skip to content

Commit

Permalink
Merge pull request #83 from vansante/add-guard-for-msoffice-slice
Browse files Browse the repository at this point in the history
Add a guard for msoffice byteslice index
  • Loading branch information
gabriel-vasile authored Jan 14, 2020
2 parents f1bd84e + 6511662 commit eda792d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/matchers/ms_office.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func msoXML(in, sig []byte) bool {
// github.com/file/file looks for the msoXML signature in the first 4 local
// headers, but some xlsx files have their signature in later headers.
// testdata/xlsx.1.xlsx is such an example, with the signature in the 5th header.
for i := 0; i < 6; i++ {
for i := 0; i < 6 && lastCheckedIndex < len(in); i++ {
in = in[lastCheckedIndex:]
pkIndex := bytes.Index(in, pkSig)
if pkIndex == -1 {
Expand Down

0 comments on commit eda792d

Please sign in to comment.