safe

Password protected secret keeper
git clone git://git.z3bra.org/safe.git
Log | Files | Refs | README | LICENSE

commit be7b04615cd9bef464bc7541b50d5c27022f80b9
parent 813084d053bc475fecc17656d1c9de39a0d3ff3d
Author: Willy Goiffon <dev@z3bra.org>
Date:   Thu, 27 Jun 2019 17:12:05 +0200

Check return status for readpass()

Diffstat:
safe.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/safe.c b/safe.c @@ -442,7 +442,9 @@ main(int argc, char *argv[]) } if (!haskey) { - readpass("password:", &passphrase, &pplen); + if (readpass("password:", &passphrase, &pplen) < 0) + return -1; + sodium_mlock(passphrase, pplen); /* write master password entry if not present */ @@ -451,7 +453,9 @@ main(int argc, char *argv[]) size_t pplen2 = 0; /* input for master password again to check */ - readpass("verify:", &passphrase2, &pplen2); + if (readpass("verify:", &passphrase2, &pplen2) < 0) + return -1; + sodium_mlock(passphrase2, pplen2); if (pplen != pplen2 || memcmp(passphrase, passphrase2, pplen)) {