Skip to content

Commit

Permalink
Bugfix: Issuer map should hold each hash only once
Browse files Browse the repository at this point in the history
  • Loading branch information
divergentdave committed Apr 15, 2019
1 parent 9949d20 commit b883628
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub mod x509;
use copy_in_place::copy_in_place;
use regex::bytes::Regex;
use reqwest::Url;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::fmt::{Debug, Display, Formatter};
use std::fs::File;
use std::io::{stdout, Read, Seek, SeekFrom};
Expand Down Expand Up @@ -186,7 +186,7 @@ impl<R: Read> BufReaderOverlap<R> {
pub struct Carver {
pub logs: Vec<LogInfo>,
pub fp_map: HashMap<CertificateFingerprint, CertificateRecord>,
pub subject_map: HashMap<NameInfo, Vec<CertificateFingerprint>>,
pub subject_map: HashMap<NameInfo, HashSet<CertificateFingerprint>>,
}

impl Carver {
Expand All @@ -208,8 +208,8 @@ impl Carver {
info.paths.push(String::from(path));

let entry = self.subject_map.entry(subject);
let fp_vec = entry.or_insert_with(Vec::new);
fp_vec.push(digest);
let fp_vec = entry.or_insert_with(HashSet::new);
fp_vec.insert(digest);
}
}

Expand Down Expand Up @@ -398,7 +398,7 @@ impl Carver {
cert: &'a Certificate,
history: &[CertificateFingerprint],
fp_map: &'a HashMap<CertificateFingerprint, CertificateRecord>,
subject_map: &'a HashMap<NameInfo, Vec<CertificateFingerprint>>,
subject_map: &'a HashMap<NameInfo, HashSet<CertificateFingerprint>>,
trust_roots: &TrustRoots,
) -> Vec<Vec<CertificateFingerprint>> {
if let Some(issuer_fps) = subject_map.get(cert.get_issuer()) {
Expand Down

0 comments on commit b883628

Please sign in to comment.