summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_message_get_strings.c
blob: 161b5549174d91219c4b40d11d65c85a4eb700bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

#include <s6-dns/s6dns-message.h>
#include "s6dns-message-internal.h"

int s6dns_message_get_strings (char *s, unsigned int rdlength, char const *packet, unsigned int packetlen, unsigned int *pos)
{
  unsigned int max = rdlength, len = 0 ;
  while (rdlength)
  {
    register unsigned int start = *pos ;
    register int r = s6dns_message_get_string_internal(s + len, max - len, packet, packetlen, pos) ;
    if (r < 0) return -1 ;
    len += r ; rdlength -= *pos - start ;
  }
  return (int)len ;
}