Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Don't access the TCP buffer vector past its size #6716

Merged
merged 1 commit into from Jun 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions pdns/dnsdist-tcp.cc
Expand Up @@ -315,7 +315,7 @@ void* tcpClientThread(int pipefd)
bool ecsAdded = false;
/* allocate a bit more memory to be able to spoof the content,
or to add ECS without allocating a new buffer */
queryBuffer.reserve(qlen + 512);
queryBuffer.resize(qlen + 512);

char* query = &queryBuffer[0];
handler.read(query, qlen, g_tcpRecvTimeout, remainingTime);
Expand Down Expand Up @@ -358,7 +358,7 @@ void* tcpClientThread(int pipefd)
uint16_t qtype, qclass;
unsigned int consumed = 0;
DNSName qname(query, qlen, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
DNSQuestion dq(&qname, qtype, qclass, &dest, &ci.remote, dh, queryBuffer.capacity(), qlen, true, &queryRealTime);
DNSQuestion dq(&qname, qtype, qclass, &dest, &ci.remote, dh, queryBuffer.size(), qlen, true, &queryRealTime);

if (!processQuery(holders, dq, poolname, &delayMsec, now)) {
goto drop;
Expand Down