From: Remi Gacogne Date: Wed, 29 May 2019 12:19:27 +0000 (+0200) Subject: dumresp: Use the correct return type for recvfrom() X-Git-Tag: dnsdist-1.4.0-beta1~8^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d8cd83c608c9109be4f3a87ac77b5cf110acffa;p=thirdparty%2Fpdns.git dumresp: Use the correct return type for recvfrom() Otherwise we can't correctly process error codes. Reported by Coverity (CID 1401645). --- diff --git a/pdns/dumresp.cc b/pdns/dumresp.cc index 354eba7461..5d457dc47f 100644 --- a/pdns/dumresp.cc +++ b/pdns/dumresp.cc @@ -202,12 +202,12 @@ try auto dh = reinterpret_cast(buffer); for(;;) { - uint16_t len = recvfrom(s.getHandle(), buffer, sizeof(buffer), 0, reinterpret_cast(&rem), &socklen); + ssize_t len = recvfrom(s.getHandle(), buffer, sizeof(buffer), 0, reinterpret_cast(&rem), &socklen); if(len < 0) unixDie("recvfrom"); - if (len < sizeof(dnsheader)) + if (static_cast(len) < sizeof(dnsheader)) unixDie("too small " + std::to_string(len)); if(dh->qr)