mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
In lwres_getaddrinfo() when checking for numeric addresses, the ntmp char array
was only initialized and used when LWRES_HAVE_SIN6_SCOPE_ID was defined, but was declared and used outside a protective #ifdef. I moved the declaration and one use of it into #ifdef protection.
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: getaddrinfo.c,v 1.30 2000/08/01 01:32:13 tale Exp $ */
|
/* $Id: getaddrinfo.c,v 1.31 2000/08/02 16:08:41 tale Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -245,15 +245,17 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
|
|||||||
(family == 0 || (flags & AI_NUMERICHOST) != 0)) {
|
(family == 0 || (flags & AI_NUMERICHOST) != 0)) {
|
||||||
char abuf[sizeof(struct in6_addr)];
|
char abuf[sizeof(struct in6_addr)];
|
||||||
char nbuf[NI_MAXHOST];
|
char nbuf[NI_MAXHOST];
|
||||||
char ntmp[NI_MAXHOST];
|
|
||||||
int addrsize, addroff;
|
int addrsize, addroff;
|
||||||
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
|
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
|
||||||
char *p, *ep;
|
char *p, *ep;
|
||||||
|
char ntmp[NI_MAXHOST];
|
||||||
lwres_uint32_t scopeid;
|
lwres_uint32_t scopeid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
|
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
|
||||||
/* scope identifier portion */
|
/*
|
||||||
|
* Scope identifier portion.
|
||||||
|
*/
|
||||||
ntmp[0] = '\0';
|
ntmp[0] = '\0';
|
||||||
if (strchr(hostname, '%') != NULL) {
|
if (strchr(hostname, '%') != NULL) {
|
||||||
strncpy(ntmp, hostname, sizeof(ntmp) - 1);
|
strncpy(ntmp, hostname, sizeof(ntmp) - 1);
|
||||||
@@ -262,7 +264,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
|
|||||||
ep = NULL;
|
ep = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vendors may want to support non-numeric
|
* Vendors may want to support non-numeric
|
||||||
* scopeid around here.
|
* scopeid around here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -296,7 +298,8 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
|
|||||||
addroff = (char *)(&SIN(0)->sin_addr) - (char *)0;
|
addroff = (char *)(&SIN(0)->sin_addr) - (char *)0;
|
||||||
family = AF_INET;
|
family = AF_INET;
|
||||||
goto common;
|
goto common;
|
||||||
} else if (ntmp[0] != 0 &&
|
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
|
||||||
|
} else if (ntmp[0] != '\0' &&
|
||||||
lwres_net_pton(AF_INET6, ntmp, abuf) != 0)
|
lwres_net_pton(AF_INET6, ntmp, abuf) != 0)
|
||||||
{
|
{
|
||||||
if (family && family != AF_INET6)
|
if (family && family != AF_INET6)
|
||||||
@@ -305,6 +308,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
|
|||||||
addroff = (char *)(&SIN6(0)->sin6_addr) - (char *)0;
|
addroff = (char *)(&SIN6(0)->sin6_addr) - (char *)0;
|
||||||
family = AF_INET6;
|
family = AF_INET6;
|
||||||
goto common;
|
goto common;
|
||||||
|
#endif
|
||||||
} else if (lwres_net_pton(AF_INET6, hostname, abuf) != 0) {
|
} else if (lwres_net_pton(AF_INET6, hostname, abuf) != 0) {
|
||||||
if (family != 0 && family != AF_INET6)
|
if (family != 0 && family != AF_INET6)
|
||||||
return (EAI_NONAME);
|
return (EAI_NONAME);
|
||||||
|
Reference in New Issue
Block a user