diff options
Diffstat (limited to 'resolv/ns_name.c')
-rw-r--r-- | resolv/ns_name.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/resolv/ns_name.c b/resolv/ns_name.c index 4990003..a0d541f 100644 --- a/resolv/ns_name.c +++ b/resolv/ns_name.c @@ -218,87 +218,6 @@ ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) } /*% - * Unpack a domain name from a message, source may be compressed. - * - * return: - *\li -1 if it fails, or consumed octets if it succeeds. - */ -int -ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, - u_char *dst, size_t dstsiz) -{ - const u_char *srcp, *dstlim; - u_char *dstp; - int n, len, checked, l; - - len = -1; - checked = 0; - dstp = dst; - srcp = src; - dstlim = dst + dstsiz; - if (srcp < msg || srcp >= eom) { - __set_errno (EMSGSIZE); - return (-1); - } - /* Fetch next label in domain name. */ - while ((n = *srcp++) != 0) { - /* Check for indirection. */ - switch (n & NS_CMPRSFLGS) { - case 0: - /* Limit checks. */ - if ((l = labellen(srcp - 1)) < 0) { - __set_errno (EMSGSIZE); - return(-1); - } - if (dstp + l + 1 >= dstlim || srcp + l >= eom) { - __set_errno (EMSGSIZE); - return (-1); - } - checked += l + 1; - *dstp++ = n; - memcpy(dstp, srcp, l); - dstp += l; - srcp += l; - break; - - case NS_CMPRSFLGS: - if (srcp >= eom) { - __set_errno (EMSGSIZE); - return (-1); - } - if (len < 0) - len = srcp - src + 1; - srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff)); - if (srcp < msg || srcp >= eom) { /*%< Out of range. */ - __set_errno (EMSGSIZE); - return (-1); - } - checked += 2; - /* - * Check for loops in the compressed name; - * if we've looked at the whole message, - * there must be a loop. - */ - if (checked >= eom - msg) { - __set_errno (EMSGSIZE); - return (-1); - } - break; - - default: - __set_errno (EMSGSIZE); - return (-1); /*%< flag error */ - } - } - *dstp = '\0'; - if (len < 0) - len = srcp - src; - return (len); -} -libresolv_hidden_def (ns_name_unpack) -strong_alias (ns_name_unpack, __ns_name_unpack) - -/*% * Pack domain name 'domain' into 'comp_dn'. * * return: |