mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-17 23:44:14 +00:00
DNS: prevent panic from rejecting invalid domain
This commit is contained in:
parent
cb1afb33e6
commit
d72ce8ee91
1 changed files with 7 additions and 2 deletions
|
@ -338,11 +338,16 @@ func (h *Handler) rejectNonIPQuery(id uint16, qType dnsmessage.Type, domain stri
|
|||
})
|
||||
builder.EnableCompression()
|
||||
common.Must(builder.StartQuestions())
|
||||
common.Must(builder.Question(dnsmessage.Question{
|
||||
err := builder.Question(dnsmessage.Question{
|
||||
Name: dnsmessage.MustNewName(domain),
|
||||
Class: dnsmessage.ClassINET,
|
||||
Type: qType,
|
||||
}))
|
||||
})
|
||||
if err != nil {
|
||||
errors.LogInfo(context.Background(), "unexpected domain ", domain, " when building reject message: ", err)
|
||||
b.Release()
|
||||
return
|
||||
}
|
||||
|
||||
msgBytes, err := builder.Finish()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue