Skip to content

Commit 4f30245

Browse files
rolandshoemakergopherbot
authored andcommitted
x509roots: catch the zero-roots case when generating the bundle
If the parser returns zero roots, don't attempt to completely remove the bundle. This may happen if, i.e., the HTTP response is 200 but has no content. An example of this may be http://go.dev/cl/535735. Change-Id: I81fc2b49c8ec813cca17fd1c807296bfb053d992 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/536136 Reviewed-by: Damien Neil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Roland Shoemaker <[email protected]>
1 parent 1d57292 commit 4f30245

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

x509roots/gen_fallback_bundle.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ func main() {
105105
log.Fatalf("failed to parse %q: %s", *certDataPath, err)
106106
}
107107

108+
if len(certs) == 0 {
109+
log.Fatal("certdata.txt appears to contain zero roots")
110+
}
111+
108112
sort.Slice(certs, func(i, j int) bool {
109113
// Sort based on the stringified subject (which may not be unique), and
110114
// break any ties by just sorting on the raw DER (which will be unique,

0 commit comments

Comments
 (0)