Skip to content

Commit 8787549

Browse files
committed
Don't panic on empty cert list or unsupported format.
1 parent b0840f8 commit 8787549

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

authenticode/src/signature.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,13 @@ impl AuthenticodeSignature {
265265
self.signed_data
266266
.certificates
267267
.as_ref()
268-
.unwrap()
269-
.0
270-
.iter()
271-
.map(|cert| {
268+
.into_iter()
269+
.flat_map(|v| v.0.iter())
270+
.filter_map(|cert| {
272271
if let cms::cert::CertificateChoices::Certificate(cert) = cert {
273-
cert
272+
Some(cert)
274273
} else {
275-
panic!()
274+
None
276275
}
277276
})
278277
}

0 commit comments

Comments
 (0)