mirror of
https://github.com/Ed1s0nZ/PrivHunterAI.git
synced 2026-10-27 19:10:55 +00:00
21 lines
399 B
Go
21 lines
399 B
Go
package scanner
|
|
|
|
import (
|
|
"bytes"
|
|
"compress/gzip"
|
|
"testing"
|
|
)
|
|
|
|
func TestGzipLimit(t *testing.T) {
|
|
var b bytes.Buffer
|
|
w := gzip.NewWriter(&b)
|
|
w.Write(bytes.Repeat([]byte("x"), maxBody+1))
|
|
w.Close()
|
|
if _, e := decodeBody(b.Bytes(), "gzip"); e == nil {
|
|
t.Fatal("decompression limit bypass")
|
|
}
|
|
if _, e := decodeBody([]byte("bad"), "gzip"); e == nil {
|
|
t.Fatal("invalid gzip accepted")
|
|
}
|
|
}
|