From 34285024531adbbc7b67506c9fc2e60f3b36b73b Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alexk@zuma.ai>
Date: Sat, 26 Oct 2024 13:26:09 +0000
Subject: [PATCH] Fix missing `limit` declarations

`put_attribute_tlvs` needs a limit setting which is missing, add it in.

Upstream-Status: Inactive-Upstream [Upstream does not take patches]
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
 mDNSShared/dnssd_clientstub.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mDNSShared/dnssd_clientstub.c b/mDNSShared/dnssd_clientstub.c
index 89cb90d947c7..316fc49ab078 100644
--- a/mDNSShared/dnssd_clientstub.c
+++ b/mDNSShared/dnssd_clientstub.c
@@ -2026,6 +2026,7 @@ DNSServiceErrorType DNSServiceRegisterInternal
     ipc_msg_hdr *hdr;
     DNSServiceErrorType err;
     union { uint16_t s; u_char b[2]; } port = { portInNetworkByteOrder };
+    const uint8_t *limit;
     (void)attr;
 
     if (!sdRef || !regtype) return kDNSServiceErr_BadParam;
@@ -2050,6 +2051,7 @@ DNSServiceErrorType DNSServiceRegisterInternal
     if (!hdr) { DNSServiceRefDeallocate(*sdRef); *sdRef = NULL; return kDNSServiceErr_NoMemory; }
     if (!callBack) hdr->ipc_flags |= IPC_FLAGS_NOREPLY;
 
+    limit = ptr + len;
     put_flags(flags, &ptr);
     put_uint32(interfaceIndex, &ptr);
     put_string(name, &ptr);
@@ -2326,6 +2328,7 @@ DNSServiceErrorType DNSServiceRegisterRecordInternal
     ipc_msg_hdr *hdr = NULL;
     DNSRecordRef rref = NULL;
     DNSRecord **p;
+    const uint8_t *limit;
     (void)attr;
 
     // Verify that only one of the following flags is set.
@@ -2375,6 +2378,7 @@ DNSServiceErrorType DNSServiceRegisterRecordInternal
     hdr = create_hdr(reg_record_request, &len, &ptr, !(flags & kDNSServiceFlagsQueueRequest), sdRef);
     if (!hdr) return kDNSServiceErr_NoMemory;
 
+    limit = ptr + len;
     put_flags(flags, &ptr);
     put_uint32(interfaceIndex, &ptr);
     put_string(fullname, &ptr);
