Skip to content

Commit

Permalink
Limit marc field terminator search to first 2048 bytes (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-vasile committed Dec 13, 2021
1 parent 7b2b9b0 commit 9908b3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/magic/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@ func Marc(raw []byte, limit uint32) bool {
}
}

// Field terminator is present.
return bytes.Contains(raw, []byte{0x1E})
// Field terminator is present in first 2048 bytes.
return bytes.Contains(raw[:min(2048, len(raw))], []byte{0x1E})
}

0 comments on commit 9908b3e

Please sign in to comment.