Skip to content

Commit

Permalink
Fix slice out of bounds in fsutil.CleanPath (#517)
Browse files Browse the repository at this point in the history
Fixes #515
  • Loading branch information
dominikschulz committed Dec 13, 2017
1 parent bf43874 commit 1739e13
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion utils/fsutil/fsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func CleanPath(path string) string {
}
}
// http://stackoverflow.com/questions/17609732/expand-tilde-to-home-directory
if path[:2] == "~/" {
if len(path) > 1 && path[:2] == "~/" {
usr, _ := user.Current()
dir := usr.HomeDir
path = strings.Replace(path, "~/", dir+"/", 1)
Expand Down
1 change: 1 addition & 0 deletions utils/fsutil/fsutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

func TestCleanPath(t *testing.T) {
m := map[string]string{
".": "",
"/home/user/../bob/.password-store": "/home/bob/.password-store",
"/home/user//.password-store": "/home/user/.password-store",
}
Expand Down
2 changes: 1 addition & 1 deletion utils/notify/notify_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Notify(subj, msg string) error {
}

return exec.Command(
osa,
osas,
"-e",
`display notification "`+msg+`" with title "`+subj+`"`,
).Start()
Expand Down

0 comments on commit 1739e13

Please sign in to comment.