Add length check for Day 4, hcl value

This commit is contained in:
Daniel S. 2020-12-06 03:20:03 +01:00
parent 0ffbddb7db
commit 561a1453df

View file

@ -76,6 +76,9 @@ impl Creds {
} }
fn validate_hcl(val: &str) -> bool { fn validate_hcl(val: &str) -> bool {
if val.len() != 7 {
return false;
}
let mut ch = val.chars(); let mut ch = val.chars();
if ch.next() != Some('#') { if ch.next() != Some('#') {
return false; return false;