diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2017-12-07 14:09:41 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2017-12-07 14:09:41 +0200 |
commit | e5f51c11919d4f66400334047b897ef0a94c6f3c (patch) | |
tree | 771d25538f5d3f3eaf5c9b6399f2601f7c3bbaae /bytesconv.go | |
parent | attempt #2 to fix TestTCP6 on travis: run the test only if local tcp6 interfa... (diff) | |
download | fasthttp-e5f51c11919d4f66400334047b897ef0a94c6f3c.tar.gz fasthttp-e5f51c11919d4f66400334047b897ef0a94c6f3c.tar.bz2 fasthttp-e5f51c11919d4f66400334047b897ef0a94c6f3c.zip |
added missing byte 0xFF into hex2intTable. This fixes panic when decoding specially crafted string like "%\xff"v20180529
Diffstat (limited to 'bytesconv.go')
-rw-r--r-- | bytesconv.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bytesconv.go b/bytesconv.go index d92150f..004d28d 100644 --- a/bytesconv.go +++ b/bytesconv.go @@ -322,15 +322,15 @@ func hexCharUpper(c byte) byte { } var hex2intTable = func() []byte { - b := make([]byte, 255) - for i := byte(0); i < 255; i++ { + b := make([]byte, 256) + for i := 0; i < 256; i++ { c := byte(16) if i >= '0' && i <= '9' { - c = i - '0' + c = byte(i) - '0' } else if i >= 'a' && i <= 'f' { - c = i - 'a' + 10 + c = byte(i) - 'a' + 10 } else if i >= 'A' && i <= 'F' { - c = i - 'A' + 10 + c = byte(i) - 'A' + 10 } b[i] = c } |