Permalink
Browse files

[PATCH] Fix randpass -f 2 to not produce empty passwords

The echo builtin interprets "-e" and "-n" which can lead randpass into
generating empty passwords under some conditions. This patch uses
the printf builtin instead to avoid the issue.

(From a private mail from Timo Juhani Lindfors).
  • Loading branch information...
1 parent 2f0cd92 commit ecd036647c345b235e9c77a0186f6d8cf1d8e424 @skx committed Dec 30, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 randpass
View
@@ -56,4 +56,5 @@ done
#
# Output the password
#
-echo $(cat /dev/urandom | tr -cd "$cset" | head -c $len )
+printf "%s\n" $(cat /dev/urandom | tr -cd "$cset" | head -c $len )
+

0 comments on commit ecd0366

Please sign in to comment.