File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff 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.
233238pub 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
You can’t perform that action at this time.
0 commit comments