From a55000a067d68cbf7aaf201b73ba2eb14090f916 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Feb 22 2018 22:48:14 +0000 Subject: Remove trailing CR/LF when reading passwords from a file. https://bugzilla.redhat.com/show_bug.cgi?id=1547641 --- diff --git a/src/dogtag.c b/src/dogtag.c index 5b55b04..871f387 100644 --- a/src/dogtag.c +++ b/src/dogtag.c @@ -476,9 +476,17 @@ main(int argc, const char **argv) /* Read the client password and/or PIN, if we need to. */ if ((pwdfile != NULL) && (pwd == NULL)) { pwd = cm_submit_u_from_file(pwdfile); + if (pwd != NULL) { + pwd = talloc_strndup(ctx, pwd, + strcspn(pwd, "\r\n")); + } } if ((pinfile != NULL) && (pin == NULL)) { pin = cm_submit_u_from_file(pinfile); + if (pin != NULL) { + pin = talloc_strndup(ctx, pin, + strcspn(pin, "\r\n")); + } } /* Figure out which form and arguments to use. */