From ff16861c16211c0968dfbc12368ab0fcae95218c Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 10 Dec 2015 16:17:54 +0100 Subject: [PATCH] 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. --- pdns/dnsdist-console.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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<