Просмотр исходного кода

Fix: check that DNS query and response have matching TXID

Rod Hynes 4 лет назад
Родитель
Сommit
0efe053510
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      psiphon/net.go

+ 3 - 0
psiphon/net.go

@@ -309,6 +309,9 @@ func ResolveIP(host string, conn net.Conn) (addrs []net.IP, ttls []time.Duration
 
 	// Process the response
 	response, err := dnsConn.ReadMsg()
+	if err == nil && response.MsgHdr.Id != query.MsgHdr.Id {
+		err = dns.ErrId
+	}
 	if err != nil {
 		return nil, nil, errors.Trace(err)
 	}