mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-07 11:36:25 +02:00
Check source content length before getting download buffer
This commit is contained in:
parent
a03d74288f
commit
c6145a8e69
@ -125,6 +125,10 @@ func readAndCheckImage(ctx context.Context, res *http.Response) (context.Context
|
||||
|
||||
if res.ContentLength > 0 {
|
||||
contentLength = int(res.ContentLength)
|
||||
|
||||
if conf.MaxSrcFileSize > 0 && contentLength > conf.MaxSrcFileSize {
|
||||
return ctx, func() {}, errSourceFileTooBig
|
||||
}
|
||||
}
|
||||
|
||||
buf := downloadBufPool.Get(contentLength)
|
||||
|
Loading…
x
Reference in New Issue
Block a user