From 41c1dbf9ef0cbba809cc3adebf792a1e728eda1c Mon Sep 17 00:00:00 2001 From: DuaneEllis-TI Date: Fri, 28 Apr 2017 11:06:30 -0700 Subject: [PATCH] Add include openthread-config.h to missing_str*.c files (#1677) * Add include openthread-config.h to missing_str*.c files * Enable _BSD_SOURCE and _DEFAULT_SOURCE --- configure.ac | 15 +++++++++++++++ src/core/utils/missing_strlcat.c | 6 ++++++ src/core/utils/missing_strlcpy.c | 6 ++++++ src/core/utils/missing_strnlen.c | 6 ++++++ 4 files changed, 33 insertions(+) diff --git a/configure.ac b/configure.ac index 199767fb9..9db759869 100644 --- a/configure.ac +++ b/configure.ac @@ -539,6 +539,7 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_BUILTIN_MBEDTLS], [test "${enable_builtin_mbed # Thread Border Agent Proxy # +AC_MSG_CHECKING([whether to enable border router proxy]) AC_ARG_ENABLE(border_agent_proxy, [AS_HELP_STRING([--enable-border-agent-proxy],[Enable border agent proxy support @<:@default=no@:>@.])], [ @@ -1132,6 +1133,20 @@ AC_MSG_NOTICE([checking required package dependencies]) # Check for headers # +#--------------------------------------------------- +# Enable BSD Security Features +# This enables strlcpy() and other friends in GNU land. +# While the references below generally speak of: "glibc" +# The ARM Embedded platform uses the nano instance of NEWLIB +# Which greatly follows and mirrors glibc. +# -------------------------------------------------- +# +# References: +# 1) http://stackoverflow.com/questions/29201515/what-does-d-default-source-do +# 2) http://man7.org/linux/man-pages/man7/feature_test_macros.7.html +# +CFLAGS="${CFLAGS} -D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1" +CXXFLAGS="${CXXFLAGS} -D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1" OLD_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} -Wno-error=address" diff --git a/src/core/utils/missing_strlcat.c b/src/core/utils/missing_strlcat.c index c28997d5c..bfad3b7e6 100644 --- a/src/core/utils/missing_strlcat.c +++ b/src/core/utils/missing_strlcat.c @@ -25,6 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "utils/wrap_string.h" size_t missing_strlcat(char *dest, const char *src, size_t size) diff --git a/src/core/utils/missing_strlcpy.c b/src/core/utils/missing_strlcpy.c index a0a2373e8..4c8bb243a 100644 --- a/src/core/utils/missing_strlcpy.c +++ b/src/core/utils/missing_strlcpy.c @@ -25,6 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "utils/wrap_string.h" size_t missing_strlcpy(char *dest, const char *src, size_t size) diff --git a/src/core/utils/missing_strnlen.c b/src/core/utils/missing_strnlen.c index 7245e14c5..a4017f441 100644 --- a/src/core/utils/missing_strnlen.c +++ b/src/core/utils/missing_strnlen.c @@ -25,6 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef OPENTHREAD_CONFIG_FILE +#include OPENTHREAD_CONFIG_FILE +#else +#include +#endif + #include "utils/wrap_string.h" size_t missing_strnlen(const char *s, size_t maxlen)