mirror of git://sourceware.org/git/glibc.git
* resolv/ns_print.c (ns_sprintrrf): Handle ns_t_a6 and ns_t_opt.
Provide better error message in case the type is unknown.
This commit is contained in:
parent
9cc198f65b
commit
9163381643
|
@ -1,5 +1,8 @@
|
||||||
2007-09-23 Ulrich Drepper <drepper@redhat.com>
|
2007-09-23 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* resolv/ns_print.c (ns_sprintrrf): Handle ns_t_a6 and ns_t_opt.
|
||||||
|
Provide better error message in case the type is unknown.
|
||||||
|
|
||||||
[BZ #4963]
|
[BZ #4963]
|
||||||
* wcsmbs/wcsnlen.c: Don't reference before checking the length.
|
* wcsmbs/wcsnlen.c: Don't reference before checking the length.
|
||||||
* string/stratcliff.c: Make usable to test wide char functions.
|
* string/stratcliff.c: Make usable to test wide char functions.
|
||||||
|
|
|
@ -112,6 +112,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
|
|
||||||
const char *comment;
|
const char *comment;
|
||||||
char tmp[100];
|
char tmp[100];
|
||||||
|
char errbuf[40];
|
||||||
int len, x;
|
int len, x;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -625,8 +626,48 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ns_t_a6: {
|
||||||
|
struct in6_addr a;
|
||||||
|
int pbyte, pbit;
|
||||||
|
|
||||||
|
/* prefix length */
|
||||||
|
if (rdlen == 0U) goto formerr;
|
||||||
|
len = SPRINTF((tmp, "%d ", *rdata));
|
||||||
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
|
pbit = *rdata;
|
||||||
|
if (pbit > 128) goto formerr;
|
||||||
|
pbyte = (pbit & ~7) / 8;
|
||||||
|
rdata++;
|
||||||
|
|
||||||
|
/* address suffix: provided only when prefix len != 128 */
|
||||||
|
if (pbit < 128) {
|
||||||
|
if (rdata + pbyte >= edata) goto formerr;
|
||||||
|
memset(&a, 0, sizeof(a));
|
||||||
|
memcpy(&a.s6_addr[pbyte], rdata, sizeof(a) - pbyte);
|
||||||
|
(void) inet_ntop(AF_INET6, &a, buf, buflen);
|
||||||
|
addlen(strlen(buf), &buf, &buflen);
|
||||||
|
rdata += sizeof(a) - pbyte;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prefix name: provided only when prefix len > 0 */
|
||||||
|
if (pbit == 0)
|
||||||
|
break;
|
||||||
|
if (rdata >= edata) goto formerr;
|
||||||
|
T(addstr(" ", 1, &buf, &buflen));
|
||||||
|
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case ns_t_opt: {
|
||||||
|
len = SPRINTF((tmp, "%u bytes", class));
|
||||||
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
comment = "unknown RR type";
|
snprintf (errbuf, sizeof (errbuf), "unknown RR type %d", type);
|
||||||
|
comment = errbuf;
|
||||||
goto hexify;
|
goto hexify;
|
||||||
}
|
}
|
||||||
return (buf - obuf);
|
return (buf - obuf);
|
||||||
|
|
Loading…
Reference in New Issue