Commit f0750073 authored by Mark Andrews's avatar Mark Andrews

check for strlcpy and strlcat

parent e0c7db2d
Pipeline #5320 passed with stages
in 1 minute and 9 seconds
......@@ -6,6 +6,7 @@ AC_CONFIG_SRCDIR([genreport.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile])
AC_CANONICAL_HOST
AC_CHECK_FUNCS(strlcpy strlcat)
AC_SEARCH_LIBS([res_mkquery],[resolv bind])
AC_SEARCH_LIBS([res_9_mkquery],[resolv bind])
AC_SEARCH_LIBS([__res_mkquery],[resolv bind])
......
......@@ -50,6 +50,9 @@
#define HMAC_CTX_free(ptr) HMAC_CTX_cleanup(ptr)
#endif
#ifndef HAVE_STRLCPY
#define strlcpy(dst, src, len) snprintf(dst, len, "%s", src)
#endif
#ifndef FD_COPY
#define FD_COPY(x, y) memmove(y, x, sizeof(*x))
......@@ -690,7 +693,11 @@ jsonadd(char **json, const char *str, size_t *len) {
*json = tmp;
*len += 10240;
}
#ifdef HAVE_STRLCAT
strlcat(*json, str, *len);
#else
strncat(*json, str, *len - strlen(*json) - 1);
#endif
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment