Fix not accounting for the possible '\n' when setting

When setting the password it includes the newline character if you type the password from stdin. This commit fixes this issue.