Skip to content

Commit

Permalink
better NUL check
Browse files Browse the repository at this point in the history
  • Loading branch information
djdv committed May 8, 2018
1 parent e1e9d51 commit a374e49
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sanitize_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ func init() {
}

func isNullDevice(path string) bool {
return strings.ToUpper(path) == os.DevNull
if len(path) != 3 {
return false
}
if path[0]|0x20 != 'n' {
return false
}
if path[1]|0x20 != 'u' {
return false
}
if path[2]|0x20 != 'l' {
return false
}
return true
}

func sanitizePath(pathElements []string) string {
Expand Down

0 comments on commit a374e49

Please sign in to comment.