diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-02-08 23:16:26 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-02-08 23:17:40 +0100 |
commit | ffef92ee0ed10551b20521f2d6e5637c8f9da798 (patch) | |
tree | a3a18d67750f96fe5088df98fa13855e86915c25 /src/password-store.sh | |
parent | 94ac2ba2c6baa268a64cb4e96421f6f1bf96fd96 (diff) | |
download | pass-ffef92ee0ed10551b20521f2d6e5637c8f9da798.tar.gz pass-ffef92ee0ed10551b20521f2d6e5637c8f9da798.tar.bz2 pass-ffef92ee0ed10551b20521f2d6e5637c8f9da798.zip |
generate: disallow zero length generated passwords
Diffstat (limited to 'src/password-store.sh')
-rwxr-xr-x | src/password-store.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index e3e5659..eac5404 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -505,7 +505,8 @@ cmd_generate() { local path="$1" local length="${2:-$GENERATED_LENGTH}" check_sneaky_paths "$path" - [[ ! $length =~ ^[0-9]+$ ]] && die "Error: pass-length \"$length\" must be a number." + [[ $length =~ ^[0-9]+$ ]] || die "Error: pass-length \"$length\" must be a number." + [[ $length -gt 0 ]] || die "Error: pass-length must be greater than zero." mkdir -p -v "$PREFIX/$(dirname -- "$path")" set_gpg_recipients "$(dirname -- "$path")" local passfile="$PREFIX/$path.gpg" |