Skip to content

Commit

Permalink
Sanitize username used for constructing log filenames.
Browse files Browse the repository at this point in the history
On Windows, os/user.Current may return a username containing a backslash.
  • Loading branch information
dsymonds committed Jul 18, 2013
1 parent c2ab0c9 commit ab6a54c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions glog_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func init() {
if err == nil {
userName = current.Username
}

// Sanitize userName since it may contain filepath separators on Windows.
userName = strings.Replace(userName, `\`, "_", -1)
}

// shortHostname returns its argument, truncating at the first period.
Expand Down

0 comments on commit ab6a54c

Please sign in to comment.