diff --git a/configure.ac b/configure.ac index e2b7b35c..238e7128 100644 --- a/configure.ac +++ b/configure.ac @@ -189,7 +189,7 @@ if test "x$want_asan_support" = "xyes"; then FKO_CHECK_COMPILER_ARG([-fsanitize=address -fno-omit-frame-pointer]) fi -dnl Decide whether or not to enable MemorySanitizer support +dnl Decide whether or not to enable UndefineSanitizer support dnl want_ubsan_support=no AC_ARG_ENABLE([ubsan-support], @@ -202,6 +202,19 @@ if test "x$want_ubsan_support" = "xyes"; then FKO_CHECK_COMPILER_ARG([-fsanitize=undefined]) fi +dnl Decide whether or not to enable MemorySanitizer support +dnl +want_memsan_support=no +AC_ARG_ENABLE([memsan-support], + [AS_HELP_STRING([--enable-memsan-support], + [Build fwknop binaries with MemorySanitizer support @<:@default is to disable@:>@])], + [want_memsan_support=$enableval], + []) + +if test "x$want_memsan_support" = "xyes"; then + FKO_CHECK_COMPILER_ARG([-fsanitize=memory -fsanitize-memory-track-origins=2]) +fi + dnl Decide whether or not force 32-bit mode dnl want_32bit_mode=no diff --git a/server/process_packet.c b/server/process_packet.c index 99fdc07c..32e99cb2 100644 --- a/server/process_packet.c +++ b/server/process_packet.c @@ -220,7 +220,9 @@ process_packet(PROCESS_PKT_ARGS_TYPE *args, PACKET_HEADER_META, /* Copy the packet for SPA processing */ - strlcpy((char *)opts->spa_pkt.packet_data, (char *)pkt_data, pkt_data_len+1); + memcpy((char *)opts->spa_pkt.packet_data, (char *)pkt_data, pkt_data_len); + opts->spa_pkt.packet_data[pkt_data_len] = '\0'; + opts->spa_pkt.packet_data_len = pkt_data_len; opts->spa_pkt.packet_proto = proto; opts->spa_pkt.packet_src_ip = src_ip; diff --git a/server/utils.c b/server/utils.c index dbab0da6..d17ea412 100644 --- a/server/utils.c +++ b/server/utils.c @@ -214,7 +214,6 @@ is_digits(const char * const str) { if(!isdigit((int)(unsigned char)str[i])) return 0; - i++; } } return 1;