Skip to content

Commit 0f850f7

Browse files
indutnybnoordhuis
authored andcommitted
deps: provide TXT chunk info in c-ares
Provide more information in `ares_txt_reply` to coalesce chunks from the same record into one string. fix #7367
1 parent 7e1c0e7 commit 0f850f7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

deps/cares/include/ares.h

+2
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ struct ares_txt_reply {
473473
struct ares_txt_reply *next;
474474
unsigned char *txt;
475475
size_t length; /* length excludes null termination */
476+
unsigned char record_start; /* 1 - if start of new record
477+
* 0 - if a chunk in the same record */
476478
};
477479

478480
struct ares_naptr_reply {

deps/cares/src/ares_parse_txt_reply.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
133133
break;
134134
}
135135

136-
++strptr;
137-
138136
/* Allocate storage for this TXT answer appending it to the list */
139137
txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY);
140138
if (!txt_curr)
@@ -152,13 +150,16 @@ ares_parse_txt_reply (const unsigned char *abuf, int alen,
152150
}
153151
txt_last = txt_curr;
154152

153+
txt_curr->record_start = strptr == aptr;
155154
txt_curr->length = substr_len;
156155
txt_curr->txt = malloc (substr_len + 1/* Including null byte */);
157156
if (txt_curr->txt == NULL)
158157
{
159158
status = ARES_ENOMEM;
160159
break;
161160
}
161+
162+
++strptr;
162163
memcpy ((char *) txt_curr->txt, strptr, substr_len);
163164

164165
/* Make sure we NULL-terminate */

0 commit comments

Comments
 (0)