From 142f42378608e593eb36ceb33895db99948427aa Mon Sep 17 00:00:00 2001 From: Sam Varshavchik Date: Fri, 21 May 2021 21:11:51 -0400 Subject: -Wall and -Werror fixes --- rfc1035/configure.ac | 29 ++++++++++++++++++++--------- rfc1035/rfc1035.h | 4 +++- rfc1035/testlookup.c | 9 +++++++-- 3 files changed, 30 insertions(+), 12 deletions(-) (limited to 'rfc1035') diff --git a/rfc1035/configure.ac b/rfc1035/configure.ac index ca692c9..84b731c 100644 --- a/rfc1035/configure.ac +++ b/rfc1035/configure.ac @@ -32,7 +32,7 @@ then fi dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(sys/types.h sys/time.h unistd.h arpa/inet.h netinet/in.h strings.h) +AC_CHECK_HEADERS(sys/types.h sys/time.h unistd.h arpa/inet.h netinet/in.h strings.h stdint.h) USENSL=no saveLIBS="$LIBS" @@ -88,8 +88,11 @@ AC_ARG_WITH(int32, #if HAVE_SYS_TYPES_H #include #endif +#if HAVE_STDINT_H +#include +#endif +uint32_t n; ],[ - (void)(uint32_t)0; ], [ AC_MSG_RESULT(yes) ; int32="uint32_t"], [ AC_MSG_RESULT(no) @@ -99,8 +102,11 @@ AC_ARG_WITH(int32, #if HAVE_SYS_TYPES_H #include #endif +#if HAVE_STDINT_H +#include +#endif +u_int32_t n; ],[ - (void)(u_int32_t)0; ], [AC_MSG_RESULT(yes); int32="u_int32_t"],[ AC_MSG_RESULT(no) @@ -139,8 +145,11 @@ AC_ARG_WITH(int16, #if HAVE_SYS_TYPES_H #include #endif +#if HAVE_STDINT_H +#include +#endif +uint16_t n; ],[ - (void)(uint16_t)0; ], [ AC_MSG_RESULT(yes) ; int16="uint16_t"], [ AC_MSG_RESULT(no) @@ -150,8 +159,11 @@ AC_ARG_WITH(int16, #if HAVE_SYS_TYPES_H #include #endif +#if HAVE_STDINT_H +#include +#endif +u_int16_t n; ],[ - (void)(u_int16_t)0; ], [AC_MSG_RESULT(yes); int16="u_int16_t"],[ AC_MSG_RESULT(no) @@ -255,9 +267,9 @@ AC_TRY_COMPILE( [ #include #include #include -] , [ struct in6_addr in6a; +] , [ in6a.s6_addr16 $LB 0 $RB =0; in6a.s6_addr32 $LB 0 $RB =0; ], @@ -268,9 +280,9 @@ AC_TRY_COMPILE( [ #include #include #include +struct in6_addr in6a; ], [ -struct in6_addr in6a; in6a.__u6_addr.__u6_addr16 $LB 0 $RB =0; in6a.__u6_addr.__u6_addr32 $LB 0 $RB =0; @@ -282,10 +294,9 @@ AC_TRY_COMPILE( [ #include #include #include - - ], [ struct in6_addr in6a; + ], [ in6a._S6_un._S6_u8 $LB 0 $RB = 0; in6a._S6_un._S6_u32 $LB 0 $RB = 0; diff --git a/rfc1035/rfc1035.h b/rfc1035/rfc1035.h index 9a92c1b..3c802e0 100644 --- a/rfc1035/rfc1035.h +++ b/rfc1035/rfc1035.h @@ -21,7 +21,9 @@ #if HAVE_NETINET_IN_H #include #endif - +#if HAVE_STDINT_H +#include +#endif #ifdef __cplusplus extern "C" { #endif diff --git a/rfc1035/testlookup.c b/rfc1035/testlookup.c index 75c701f..869e806 100644 --- a/rfc1035/testlookup.c +++ b/rfc1035/testlookup.c @@ -312,8 +312,13 @@ char ptrbuf[RFC1035_MAXNAMESIZE+1]; { char namebuf[RFC1035_MAXNAMESIZE+1]; - namebuf[0]=0; - strncat(namebuf, q_name, RFC1035_MAXNAMESIZE); + size_t l=strlen(q_name); + + if (l > RFC1035_MAXNAMESIZE) + l=RFC1035_MAXNAMESIZE; + + memcpy(namebuf, q_name, l); + namebuf[l]=0; if (rfc1035_resolve_cname_multiple(&res, namebuf, q_type, q_class, -- cgit v1.2.3