mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
Make sure slice is not out of range when reading XML prolog
This commit is contained in:
parent
70be08eaf8
commit
f3bff76aa1
3 changed files with 8 additions and 1 deletions
|
@ -84,7 +84,12 @@ func (r *Response) EnsureUnicodeBody() (err error) {
|
|||
|
||||
// We ignore documents with encoding specified in XML prolog.
|
||||
// This is going to be handled by the XML parser.
|
||||
if xmlEncodingRegex.Match(buffer[0:1024]) {
|
||||
length := 1024
|
||||
if len(buffer) < 1024 {
|
||||
length = len(buffer)
|
||||
}
|
||||
|
||||
if xmlEncodingRegex.Match(buffer[0:length]) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue