Crude fix for #961

This commit is contained in:
Frank Denis 2019-10-15 00:47:05 +02:00
parent 858957ce91
commit 55c6cb6c79
1 changed files with 3 additions and 0 deletions

View File

@ -87,6 +87,9 @@ func (proxy *Proxy) Encrypt(serverInfo *ServerInfo, packet []byte, proto string)
minQuestionSize += int(xpad[0])
}
paddedLength := Min(MaxDNSUDPPacketSize, (Max(minQuestionSize, QueryOverhead)+63) & ^63)
if serverInfo.RelayUDPAddr != nil && proto == "tcp" {
paddedLength = MaxDNSPacketSize
}
if QueryOverhead+len(packet)+1 > paddedLength {
err = errors.New("Question too large; cannot be padded")
return