From 68658bf83fd0ba6e0c16228cfe3892dc95980a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Thu, 9 May 2024 00:24:19 +0200 Subject: [PATCH] [fix] webnsupdate: trim newlines from pass file --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9e78ae8..2847804 100644 --- a/src/main.rs +++ b/src/main.rs @@ -145,8 +145,9 @@ async fn main() -> Result<()> { password_hash: None, }; if let Some(password_file) = password_file { - let pass = std::fs::read(password_file).into_diagnostic()?; - state.password_hash = Some(pass.leak()); + let pass = std::fs::read_to_string(password_file).into_diagnostic()?; + let pass: Box<[u8]> = pass.trim().as_bytes().into(); + state.password_hash = Some(Box::leak(pass)); } else { ensure!(insecure, "a password must be used"); }