Skip to content

Commit 63ec7b5

Browse files
committed
Address Michael's feedback
1 parent 8b30076 commit 63ec7b5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/x509_util/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ pub struct ValidationOptions {
230230
///
231231
/// Returns a `ValidationError` if the chain fails to validate. Returns an error
232232
/// of type `E` if the hook errors.
233+
///
234+
/// # Panics
235+
///
236+
/// This section is here to avoid linter complaints about the `unwrap()` below,
237+
/// but this function won't panic.
233238
pub fn validate_chain_lax<T, E, F>(
234239
raw_chain: &[Vec<u8>],
235240
roots: &CertPool,
@@ -296,8 +301,8 @@ where
296301
// Add the intermediate to the validated chain.
297302
validated_intermediates.push(intermediate_cert);
298303

299-
// Check this intermediate next.
300-
current_cert = &validated_intermediates[i];
304+
// Get a reference to the intermediate we just pushed to check next.
305+
current_cert = validated_intermediates.last().unwrap();
301306
}
302307

303308
// If we haven't yet found a path to a trusted root, check if we can find

0 commit comments

Comments
 (0)