From 92792f0e8bd5fc20f387f71391e5e04d7145be82 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 6 Jun 2021 01:05:14 +0200 Subject: [PATCH] Prevent remotely triggerable crash in ODoH config parser --- dnscrypt-proxy/odoh.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dnscrypt-proxy/odoh.go b/dnscrypt-proxy/odoh.go index 148f0a28..9121a4d4 100644 --- a/dnscrypt-proxy/odoh.go +++ b/dnscrypt-proxy/odoh.go @@ -63,6 +63,9 @@ func parseODoHTargetConfig(config []byte) (ODoHTargetConfig, error) { } func parseODoHTargetConfigs(configs []byte) ([]ODoHTargetConfig, error) { + if len(configs) <= 2 { + return nil, fmt.Errorf("No configs") + } length := binary.BigEndian.Uint16(configs) if len(configs) != int(length)+2 { return nil, fmt.Errorf("Malformed configs")