diff options
Diffstat (limited to 'src/encoding')
| -rw-r--r-- | src/encoding/pem/pem.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/encoding/pem/pem.go b/src/encoding/pem/pem.go index 1da60d3227..6bf2b41ad0 100644 --- a/src/encoding/pem/pem.go +++ b/src/encoding/pem/pem.go @@ -95,6 +95,9 @@ func Decode(data []byte) (p *Block, rest []byte) { for { // If we've already tried parsing a block, skip past the END we already // saw. + if endTrailerIndex < 0 || endTrailerIndex > len(rest) { + return nil, data + } rest = rest[endTrailerIndex:] // Find the first END line, and then find the last BEGIN line before |
