Fix: potential panic in putMsgToCache (#2634)
When the upstream DNS server returns a message that contains no questions (i.e. QDCOUNT == 0), `putMsgToCache` will trigger an out-of-range panic. Issue: #2524 Comment: https://github.com/Dreamacro/clash/issues/2524#issuecomment-1477477601
This commit is contained in:
@ -162,7 +162,7 @@ func (r *Resolver) exchangeWithoutCache(ctx context.Context, m *D.Msg) (msg *D.M
|
||||
|
||||
msg := result.(*D.Msg)
|
||||
|
||||
putMsgToCache(r.lruCache, q.String(), msg)
|
||||
putMsgToCache(r.lruCache, q.String(), q, msg)
|
||||
}()
|
||||
|
||||
isIPReq := isIPRequest(q)
|
||||
|
Reference in New Issue
Block a user