From 8adfbf2dc34560df7436c89b59a9749d2dd3b78e Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 12 Feb 2017 15:35:50 +0100 Subject: Check for trailing garbage after the password From the comment: // CheckTrailingGarbage tries to read one byte from stdin and exits with a // fatal error if the read returns any data. // This is meant to be called after reading the password, when there is no more // data expected. This helps to catch problems with third-party tools that // interface with gocryptfs. --- mount.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mount.go') diff --git a/mount.go b/mount.go index cd14dd9..032589d 100644 --- a/mount.go +++ b/mount.go @@ -22,6 +22,7 @@ import ( "github.com/rfjakob/gocryptfs/internal/ctlsock" "github.com/rfjakob/gocryptfs/internal/fusefrontend" "github.com/rfjakob/gocryptfs/internal/fusefrontend_reverse" + "github.com/rfjakob/gocryptfs/internal/readpassword" "github.com/rfjakob/gocryptfs/internal/tlog" ) @@ -96,6 +97,7 @@ func doMount(args *argContainer) int { } os.Exit(ErrExitLoadConf) } + readpassword.CheckTrailingGarbage() printMasterKey(masterkey) } // We cannot use JSON for pretty-printing as the fields are unexported -- cgit v1.2.3