Skip to content

Commit

Permalink
Merge pull request #8 from alecthomas/master
Browse files Browse the repository at this point in the history
Prevent panic when bad data is returned from Secrets().
  • Loading branch information
abbot committed Jun 18, 2014
2 parents 0c7409b + 4e3c4de commit c0ef453
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (a *BasicAuth) CheckAuth(r *http.Request) string {
if passwd == "" {
return ""
}
if passwd[:5] == "{SHA}" {
if strings.HasPrefix(passwd, "{SHA}") {
d := sha1.New()
d.Write([]byte(pair[1]))
if passwd[5:] != base64.StdEncoding.EncodeToString(d.Sum(nil)) {
Expand Down

0 comments on commit c0ef453

Please sign in to comment.