From e4930db19d3efb0617a33c1bc43510e6e5f29835 Mon Sep 17 00:00:00 2001 From: Chenfan Zhang Date: Sat, 4 Jul 2026 07:05:21 +0800 Subject: [PATCH] [dns] fix otDnsEncodeTxtData parameter type mismatch (#13288) This commit fixes a parameter type mismatch between declaration and implementation of function `otDnsEncodeTxtData()`. `include/openthread/dns.h` provides an API `otDnsEncodeTxtData()` for encoding TXT record entries list into TXT data, which is implemented in `src/core/api/dns_api.cpp`. The problem is, `otDnsEncodeTxtData()` is declared with `uint16_t aNumTxtEntries` in the public header, but defined with `uint8_t aNumTxtEntries` in the implementation. This mismatch can lead to symbol/ABI inconsistency for C callers and causes link failure in downstream integrations. This commit changes the type of parameter `aNumTxtEntries` in cpp implementation from `uint8_t` to `uint16_t`, to follow up type definitions in the declaration and later called `Dns::TxtEntry::AppendEntries()`. So that downstream integrations will not run into link failure when using `otDnsEncodeTxtData()`. --- src/core/api/dns_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/api/dns_api.cpp b/src/core/api/dns_api.cpp index 71d6fc2eb..aeff4bf9a 100644 --- a/src/core/api/dns_api.cpp +++ b/src/core/api/dns_api.cpp @@ -49,7 +49,7 @@ otError otDnsGetNextTxtEntry(otDnsTxtEntryIterator *aIterator, otDnsTxtEntry *aE } otError otDnsEncodeTxtData(const otDnsTxtEntry *aTxtEntries, - uint8_t aNumTxtEntries, + uint16_t aNumTxtEntries, uint8_t *aTxtData, uint16_t *aTxtDataLength) {