From: Remi Gacogne Date: Thu, 10 Dec 2015 15:17:54 +0000 (+0100) Subject: Fix zero-sized response in dnsdist client without libsodium X-Git-Tag: dnsdist-1.0.0-alpha1~78^2~1^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff16861c16211c0968dfbc12368ab0fcae95218c;p=thirdparty%2Fpdns.git Fix zero-sized response in dnsdist client without libsodium Without libsodium support, we do actually get zero-sized response (no padding). Reported by @gryphius in issue #3015. --- diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 31bf6f5dff..41d17b2463 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -65,16 +65,21 @@ void doClient(ComboAddress server, const std::string& command) putMsgLen32(fd, msg.length()); writen2(fd, msg); uint32_t len; - if(!getMsgLen32(fd, &len) || len == 0) { + if(!getMsgLen32(fd, &len)) { cout << "Connection closed by the server." << endl; break; } - boost::scoped_array resp(new char[len]); - readn2(fd, resp.get(), len); - msg.assign(resp.get(), len); - msg=sodDecryptSym(msg, g_key, theirs); - cout< 0) { + boost::scoped_array resp(new char[len]); + readn2(fd, resp.get(), len); + msg.assign(resp.get(), len); + msg=sodDecryptSym(msg, g_key, theirs); + cout<