Memory bug fix

This commit is contained in:
boreddevnl
2026-03-01 00:52:25 +01:00
parent 8afb488539
commit a4e0a42042
18 changed files with 174 additions and 213 deletions

View File

@@ -9,6 +9,7 @@ static ipv4_address_t dns_result_ip;
static bool dns_resolved = false;
void dns_handle_response(void *data, uint16_t len) {
(void)len;
dns_header_t *dns = (dns_header_t*)data;
if ((ntohs(dns->flags) & 0x8000) == 0) return; // Not a response
@@ -30,6 +31,9 @@ void dns_handle_response(void *data, uint16_t len) {
uint32_t ttl = ntohl(*(uint32_t*)p); p += 4;
uint16_t dlen = ntohs(*(uint16_t*)p); p += 2;
(void)class;
(void)ttl;
if (type == 1 && dlen == 4) { // A Record
dns_result_ip.bytes[0] = p[0];
dns_result_ip.bytes[1] = p[1];