From 64793fedf4ac8eebe05c57af75877944c60f03a4 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 18 Aug 2021 15:47:17 +0200 Subject: Fix issues found by ineffassign gocryptfs$ ineffassign ./... /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/configfile/config_file.go:243:2: ineffectual assignment to scryptHash /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/configfile/config_file.go:272:2: ineffectual assignment to scryptHash /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/file.go:285:3: ineffectual assignment to fileID /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/node.go:367:3: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/node_open_create.go:68:2: ineffectual assignment to fd /home/jakob/go/src/github.com/rfjakob/gocryptfs/mount.go:308:2: ineffectual assignment to masterkey /home/jakob/go/src/github.com/rfjakob/gocryptfs/gocryptfs-xray/xray_main.go:156:13: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/prepare_syscall_test.go:65:16: ineffectual assignment to errno /home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/syscallcompat/open_nofollow_test.go:34:2: ineffectual assignment to fd /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:111:6: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:181:2: ineffectual assignment to sz /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:198:2: ineffectual assignment to sz /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/main_test.go:365:8: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/xattr/xattr_fd_test.go:30:6: ineffectual assignment to err /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/xattr/xattr_fd_test.go:66:6: ineffectual assignment to err --- gocryptfs-xray/xray_main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gocryptfs-xray') diff --git a/gocryptfs-xray/xray_main.go b/gocryptfs-xray/xray_main.go index b99268b..e68e463 100644 --- a/gocryptfs-xray/xray_main.go +++ b/gocryptfs-xray/xray_main.go @@ -154,10 +154,19 @@ func dumpMasterKey(fn string, fido2Path string) { pw = readpassword.Once(nil, nil, "") } masterkey, err := cf.DecryptMasterKey(pw) - fmt.Println(hex.EncodeToString(masterkey)) + // Purge password from memory for i := range pw { pw[i] = 0 } + if err != nil { + tlog.Fatal.Println(err) + os.Exit(exitcodes.LoadConf) + } + fmt.Println(hex.EncodeToString(masterkey)) + // Purge masterkey from memory + for i := range masterkey { + masterkey[i] = 0 + } } func inspectCiphertext(fd *os.File, aessiv bool) { -- cgit v1.2.3