From dca231f32ef65d51e4b5ffa88965acb235fdf80b Mon Sep 17 00:00:00 2001 From: Kai Jan Kriegel Date: Mon, 21 Nov 2022 06:35:07 +0100 Subject: [PATCH] trim trailing \0 at the correct point --- bffhd/authentication/fabfire/server.rs | 4 ++-- bffhd/authentication/fabfire_bin/server.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bffhd/authentication/fabfire/server.rs b/bffhd/authentication/fabfire/server.rs index 3108dd8..7a71d7d 100644 --- a/bffhd/authentication/fabfire/server.rs +++ b/bffhd/authentication/fabfire/server.rs @@ -495,9 +495,9 @@ impl Authentication for FabFire { Ok(_) => { match apdu_response.body { Some(data) => { - let authid = String::from_utf8(data).unwrap(); + let authid = String::from_utf8(data).unwrap().trim_matches(char::from(0)).to_string(); let prov = ThisProvider::::with( - authid.trim_matches(char::from(0)), + &authid, ); let key = session .need_with::(&prov, |key| { diff --git a/bffhd/authentication/fabfire_bin/server.rs b/bffhd/authentication/fabfire_bin/server.rs index 5e8cbb1..e9367ab 100644 --- a/bffhd/authentication/fabfire_bin/server.rs +++ b/bffhd/authentication/fabfire_bin/server.rs @@ -353,9 +353,9 @@ impl Authentication for FabFire { Ok(_) => { match apdu_response.body { Some(data) => { - let authid = String::from_utf8(data).unwrap(); + let authid = String::from_utf8(data).unwrap().trim_matches(char::from(0)).to_string(); let prov = ThisProvider::::with( - authid.trim_matches(char::from(0)), + &authid, ); let key = session .need_with::(&prov, |key| {