pullup from BIND 8:

1185.   [bug]           libbind: don't assume statp->_u._ext.ext is valid
                        unless RES_INIT is set when calling res_*init().

1184.   [bug]           libbind: call res_ndestroy() if RES_INIT is set
                        when res_*init() is called.
This commit is contained in:
Mark Andrews 2002-01-22 03:16:28 +00:00
parent 852fa3b2e3
commit 5da1e589c2
2 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,9 @@
1185. [bug] libbind: don't assume statp->_u._ext.ext is valid
unless RES_INIT is set when calling res_*init().
1184. [bug] libbind: call res_ndestroy() if RES_INIT is set
when res_*init() is called.
1183. [bug] Handle ENOSR error when writing to the internal
control pipe. [RT #2395]

View file

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static const char rcsid[] = "$Id: res_init.c,v 1.10 2001/11/01 04:50:59 marka Exp $";
static const char rcsid[] = "$Id: res_init.c,v 1.11 2002/01/22 03:16:28 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -169,6 +169,9 @@ __res_vinit(res_state statp, int preinit) {
statp->id = res_randomid();
}
if ((statp->options & RES_INIT) != 0)
res_ndestroy(statp);
#ifdef USELOOPBACK
statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
#else
@ -187,14 +190,12 @@ __res_vinit(res_state statp, int preinit) {
statp->qhook = NULL;
statp->rhook = NULL;
statp->_u._ext.nscount = 0;
if (statp->_u._ext.ext == NULL) {
statp->_u._ext.ext = malloc(sizeof(*statp->_u._ext.ext));
if (statp->_u._ext.ext != NULL) {
statp->_u._ext.ext = malloc(sizeof(*statp->_u._ext.ext));
if (statp->_u._ext.ext != NULL) {
memset(statp->_u._ext.ext, 0, sizeof(*statp->_u._ext.ext));
statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
strcpy(statp->_u._ext.ext->nsuffix, "ip6.int");
strcpy(statp->_u._ext.ext->bsuffix, "ip6.arpa");
}
}
#ifdef RESOLVSORT
statp->nsort = 0;