Skip to content

Commit f5b0c39

Browse files
jukkarnashif
authored andcommitted
net: dns: Parse individual labels in CNAME properly
The ANCOUNT has nothing to do with label count so remove the original while loop and just go through all the labels until we have read all of them. Signed-off-by: Jukka Rissanen <[email protected]> Signed-off-by: Flavio Ceolin <[email protected]>
1 parent 0bc8a0d commit f5b0c39

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

subsys/net/lib/dns/dns_pack.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,10 @@ int dns_copy_qname(u8_t *buf, u16_t *len, u16_t size,
352352
u8_t *msg = dns_msg->msg;
353353
u16_t lb_size;
354354
int rc = -EINVAL;
355-
int i = 0;
356355

357356
*len = 0U;
358357

359-
/* Iterate ANCOUNT + 1 to allow the Query's QNAME to be parsed.
360-
* This is required to avoid 'alias loops'
361-
*/
362-
while (i++ < dns_header_ancount(dns_msg->msg) + 1) {
358+
while (1) {
363359
if (pos >= msg_size) {
364360
rc = -ENOMEM;
365361
break;

0 commit comments

Comments
 (0)