1
0
mirror of https://github.com/golang/go synced 2024-11-21 11:44:43 -07:00

encoding/xml: reject processing instructions with reserved names

This is required by the spec.

Fixes: #68499
This commit is contained in:
Demi Marie Obenour 2024-07-14 17:56:38 -04:00
parent 239666cd73
commit 1adf826302

View File

@ -610,6 +610,11 @@ func (d *Decoder) rawToken() (Token, error) {
}
return nil, d.err
}
if len(target) >= 3 && target[0:3] != xmlPrefix &&
(target[0] | 0x20) == 'x' && (target[1] | 0x20) == 'm' && (target[2] | 0x20) == 'l' {
d.err = d.syntaxError("Processing instruction name is reserved")
return nil, d.err
}
d.space()
d.buf.Reset()
var b0 byte