Prevent remotely triggerable crash in ODoH config parser
This commit is contained in:
parent
1cdb71cd7c
commit
92792f0e8b
|
@ -63,6 +63,9 @@ func parseODoHTargetConfig(config []byte) (ODoHTargetConfig, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseODoHTargetConfigs(configs []byte) ([]ODoHTargetConfig, error) {
|
func parseODoHTargetConfigs(configs []byte) ([]ODoHTargetConfig, error) {
|
||||||
|
if len(configs) <= 2 {
|
||||||
|
return nil, fmt.Errorf("No configs")
|
||||||
|
}
|
||||||
length := binary.BigEndian.Uint16(configs)
|
length := binary.BigEndian.Uint16(configs)
|
||||||
if len(configs) != int(length)+2 {
|
if len(configs) != int(length)+2 {
|
||||||
return nil, fmt.Errorf("Malformed configs")
|
return nil, fmt.Errorf("Malformed configs")
|
||||||
|
|
Loading…
Reference in New Issue