authorgravatar for h_n91@hotmail.comDraagrenKirneh <h_n91@hotmail.com> 2023-05-22 16:13:34+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-05-22 16:13:34+02:00
log957f269a4259207400f7bac9bd8a200c1c5a53d7
treee8d645da9a483e2cdd3a97f6e1d9c9f0aa6d937a
parent89f622fc681d8848e3067d9de76fe3b3a8ea6d07
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Ignore certificates with unknown OID (#15539)

* Ignore certificates with unknown OID * switch directly after catch

1 files changed, 8 insertions(+), 2 deletions(-)

lib/std/crypto/Certificate/Bundle.zig+8-2
......@@ -244,10 +244,16 @@ pub fn parseCert(cb: *Bundle, gpa: Allocator, decoded_start: u32, now_sec: i64)
244244 // the subject name, we pre-parse all of them to make sure and only
245245 // include in the bundle ones that we know will parse. This way we can
246246 // use `catch unreachable` later.
247 const parsed_cert = try Certificate.parse(.{
247 const parsed_cert = Certificate.parse(.{
248248 .buffer = cb.bytes.items,
249249 .index = decoded_start,
250 });
250 }) catch |err| switch (err) {
251 error.CertificateHasUnrecognizedObjectId => {
252 cb.bytes.items.len = decoded_start;
253 return;
254 },
255 else => |e| return e,
256 };
251257 if (now_sec > parsed_cert.validity.not_after) {
252258 // Ignore expired cert.
253259 cb.bytes.items.len = decoded_start;