jws: fix base64Decode for strings of length 1 (mod 4).

Change-Id: I5369e4d5454de2cf041363af1328f69d526b17d4
Reviewed-on: https://go-review.googlesource.com/16750
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
David Symonds 2015-11-09 11:52:04 +11:00
parent e347d2238c
commit d4780cd8b5
1 changed files with 2 additions and 0 deletions

View File

@ -161,6 +161,8 @@ func base64Encode(b []byte) string {
func base64Decode(s string) ([]byte, error) {
// add back missing padding
switch len(s) % 4 {
case 1:
s += "==="
case 2:
s += "=="
case 3: