In `csr.NamesFromCSR`, there's a subtle trap when appending to a slice. We set `sans := csr.DNSNames` and then depending on the existence of a CommonName, we append to sans which could mutate the backing array in `csr.DNSNames`. Instead, we will force a new allocation meaning that `sans` has its own pointer to a distinct memory unrelated to the pointer of `csr.DNSNames`. See this blog post too: https://build-your-own.org/blog/20230316_go_full_slice/ |
||
|---|---|---|
| .. | ||
| csr.go | ||
| csr_test.go | ||