diff --git a/configure.ac b/configure.ac index c27977324..b4409fa34 100644 --- a/configure.ac +++ b/configure.ac @@ -877,7 +877,7 @@ dnl ----- Start of "Things needed for gldns" section dnl ----- dnl --------------------------------------------------------------------------- -AC_CHECK_HEADERS([stdarg.h stdint.h netinet/in.h arpa/inet.h netdb.h sys/socket.h time.h sys/time.h bsd/string.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([stdarg.h stdint.h netinet/in.h arpa/inet.h netdb.h sys/socket.h time.h sys/time.h bsd/string.h sys/select.h],,, [AC_INCLUDES_DEFAULT]) dnl Check the printf-format attribute (if any) dnl result in HAVE_ATTR_FORMAT. @@ -975,6 +975,14 @@ AC_SUBST(C99COMPATFLAGS) AH_BOTTOM([ #include +#include +#include +#include +#include + +#ifdef HAVE_BSD_STRING_H +#include +#endif #ifdef __cplusplus extern "C" { @@ -985,11 +993,13 @@ extern "C" { #include #endif -#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY +#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY || !defined(strlcpy) size_t strlcpy(char *dst, const char *src, size_t siz); #else +#ifndef __BSD_VISIBLE #define __BSD_VISIBLE 1 #endif +#endif #if !defined(HAVE_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM uint32_t arc4random(void); #endif @@ -1030,11 +1040,6 @@ unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest); # define GLDNS_BUILD_CONFIG_HAVE_SSL 1 #endif -#include -#include -#include -#include - #ifdef HAVE_STDARG_H #include #endif @@ -1045,6 +1050,10 @@ unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest); #include #endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif + #ifdef HAVE_NETINET_IN_H #include #endif @@ -1092,10 +1101,6 @@ unsigned char *SHA512(void* data, unsigned int data_len, unsigned char *digest); # endif #endif -#ifdef HAVE_BSD_STRING_H -#include -#endif - #ifdef HAVE_LIBUNBOUND #include #endif diff --git a/src/context.c b/src/context.c index 664821607..8a71e727c 100644 --- a/src/context.c +++ b/src/context.c @@ -702,7 +702,7 @@ set_os_defaults(struct getdns_context *context) token = parse + strcspn(parse, " \t\r\n"); *token = 0; - (void) strcpy(domain, parse); + (void) strlcpy(domain, parse, sizeof(domain)); } else if (strncmp(parse, "search", 6) == 0) { parse += 6; diff --git a/src/convert.c b/src/convert.c index c033874b1..082fe7db6 100644 --- a/src/convert.c +++ b/src/convert.c @@ -36,9 +36,9 @@ #include #include #include -#include #include "config.h" #ifdef HAVE_LIBIDN +#include #include #endif #include "getdns/getdns.h"