]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/pem: clarify Decode only works on lines
authorSean Liao <sean@liao.dev>
Sat, 6 Aug 2022 13:28:16 +0000 (14:28 +0100)
committerGopher Robot <gobot@golang.org>
Wed, 5 Mar 2025 15:57:03 +0000 (07:57 -0800)
Fixes #53524

Change-Id: I929ee3c055c3ca564cd6cc374124f493aea2fbf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/421636
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/encoding/pem/pem.go

index 7a515fd3632be07629afd7c0c3a4e76a6ab11d16..dcc7416ee21ffec6ba13c500fc0ae80c464e4a39 100644 (file)
@@ -85,7 +85,7 @@ var colon = []byte(":")
 // Decode will find the next PEM formatted block (certificate, private key
 // etc) in the input. It returns that block and the remainder of the input. If
 // no PEM data is found, p is nil and the whole of the input is returned in
-// rest.
+// rest. Blocks must start at the beginning of a line and end at the end of a line.
 func Decode(data []byte) (p *Block, rest []byte) {
        // pemStart begins with a newline. However, at the very beginning of
        // the byte array, we'll accept the start string without it.