Correct warnings for the slice length condition

This commit is contained in:
moznion
2020-11-24 01:39:39 +09:00
parent 7a036d58ad
commit d0a954fc6e
2 changed files with 3 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ impl Attribute {
return Err("the length of plain_text has to be within 128, but the given value is longer".to_owned());
}
if secret.len() <= 0 {
if secret.len() == 0 {
return Err("secret hasn't be empty, but the given value is empty".to_owned());
}
@@ -127,7 +127,7 @@ impl Attribute {
return Err(format!("invalid attribute length {}", self.0.len()));
}
if secret.len() <= 0 {
if secret.len() == 0 {
return Err("secret hasn't be empty, but the given value is empty".to_owned());
}

View File

@@ -103,7 +103,7 @@ impl Server {
return;
}
};
if secret.len() <= 0 {
if secret.len() == 0 {
error!("empty secret returned from secret source; empty secret is prohibited");
return;
}