Skip to content

Commit

Permalink
Don't extend from an empty slice.
Browse files Browse the repository at this point in the history
Fixes #206.
  • Loading branch information
brotskydotcom committed Jul 14, 2024
1 parent ea683f2 commit d3b28a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion security-framework/src/passwords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ fn get_password_and_release(data: CFTypeRef) -> Result<Vec<u8>> {
if type_id == CFData::type_id() {
let val = unsafe { CFData::wrap_under_create_rule(data as CFDataRef) };
let mut vec = Vec::new();
vec.extend_from_slice(val.bytes());
if val.len() > 0 {
vec.extend_from_slice(val.bytes());
}
return Ok(vec);
}
// unexpected: we got a reference to some other type.
Expand Down

0 comments on commit d3b28a5

Please sign in to comment.