Skip to content

Commit 27e6f35

Browse files
authored
DNSServer fix custom code replies (espressif#7475)
custom code reply was sending garbage from a buffer instead of crafted DNS header
1 parent 5bc37a7 commit 27e6f35

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

libraries/DNSServer/src/DNSServer.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ String DNSServer::getDomainNameWithoutWwwPrefix()
175175

176176
void DNSServer::replyWithIP()
177177
{
178-
if (_buffer == NULL) return;
179-
180178
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
181179

182180
// Change the type of message to a response and set the number of answers equal to
@@ -215,12 +213,11 @@ void DNSServer::replyWithIP()
215213

216214
void DNSServer::replyWithCustomCode()
217215
{
218-
if (_buffer == NULL) return;
219216
_dnsHeader->QR = DNS_QR_RESPONSE;
220217
_dnsHeader->RCode = (unsigned char)_errorReplyCode;
221218
_dnsHeader->QDCount = 0;
222219

223220
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
224-
_udp.write(_buffer, sizeof(DNSHeader));
221+
_udp.write((unsigned char*)_dnsHeader, sizeof(DNSHeader));
225222
_udp.endPacket();
226223
}

0 commit comments

Comments
 (0)