aboutsummaryrefslogtreecommitdiff
path: root/init_dir.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-02-18 15:22:22 +0100
committerJakob Unterwurzacher2018-02-18 15:22:22 +0100
commit2cf050d69e9cab45015619e48ea96993129bab44 (patch)
tree097ed3e3da99be30861614804e1e886dff15b76f /init_dir.go
parent3b8f5cbb17c964224456bb36b096feafb0e24f44 (diff)
main: zero password once we are done with it
Overwrite the password we have got from the user with zeros once we don't need it anymore, and make sure the variable runs out of scope.
Diffstat (limited to 'init_dir.go')
-rw-r--r--init_dir.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/init_dir.go b/init_dir.go
index b13f741..ea902ec 100644
--- a/init_dir.go
+++ b/init_dir.go
@@ -45,8 +45,9 @@ func initDir(args *argContainer) {
tlog.Fatal.Println(err)
os.Exit(exitcodes.WriteConf)
}
- // Note: cannot overwrite password because in Go, strings are
- // read-only byte slices.
+ for i := range password {
+ password[i] = 0
+ }
// password runs out of scope here
}
// Forward mode with filename encryption enabled needs a gocryptfs.diriv