X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3129bd50d30dad985764436f147ad44bc54f2005..accf0ca336a82397063fb262c64a01d2a8947ca7:/apt-pkg/contrib/srvrec.cc diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc index be159bad9..cafee1acf 100644 --- a/apt-pkg/contrib/srvrec.cc +++ b/apt-pkg/contrib/srvrec.cc @@ -50,7 +50,7 @@ bool GetSrvRecords(std::string host, int port, std::vector &Result) bool GetSrvRecords(std::string name, std::vector &Result) { - unsigned char answer[PACKETSZ]; + unsigned char answer[NS_PACKETSZ]; int answer_len, compressed_name_len; int answer_count; @@ -77,7 +77,7 @@ bool GetSrvRecords(std::string name, std::vector &Result) return _error->Warning("dn_skipname failed %i", compressed_name_len); // pt points to the first answer record, go over all of them now - unsigned char *pt = answer+sizeof(HEADER)+compressed_name_len+QFIXEDSZ; + unsigned char *pt = answer+sizeof(HEADER)+compressed_name_len+NS_QFIXEDSZ; while ((int)Result.size() < answer_count && pt < answer+answer_len) { u_int16_t type, klass, priority, weight, port, dlen; @@ -185,7 +185,7 @@ SrvRec PopFromSrvRecs(std::vector &Recs) [&I](SrvRec const &J) { return I->priority != J.priority; }); // clock seems random enough. - I += clock() % std::distance(I, J); + I += std::max(static_cast(0), clock()) % std::distance(I, J); SrvRec const selected = std::move(*I); Recs.erase(I);