diff --git a/.clusterfuzzlite/Dockerfile b/.clusterfuzzlite/Dockerfile index f979cdfe..316c26ea 100644 --- a/.clusterfuzzlite/Dockerfile +++ b/.clusterfuzzlite/Dockerfile @@ -1,4 +1,6 @@ FROM gcr.io/oss-fuzz-base/base-builder:v1 + +ENV CLUSTERFUZZLITE=TRUE RUN apt-get update && apt-get install -y bison libssl-dev libevent-dev libsystemd-dev COPY . $SRC/openiked-portable WORKDIR openiked-portable diff --git a/CMakeLists.txt b/CMakeLists.txt index cd6cc3f2..95c4e3fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,7 +404,7 @@ endif() if(CLUSTERFUZZ) message("Compiling parser-libfuzzer") add_subdirectory(regress/parser-libfuzzer) - if (NOT DEFINED ENV{CC} OR NOT DEFINED ENV{CFLAGS}) + if (NOT DEFINED ENV{CLUSTERFUZZLITE}) set(CMAKE_C_COMPILER clang) string(APPEND CMAKE_C_FLAGS " -g -O1 -fsanitize=fuzzer-no-link") endif() diff --git a/iked/CMakeLists.txt b/iked/CMakeLists.txt index 3de5e8fb..685f19d2 100644 --- a/iked/CMakeLists.txt +++ b/iked/CMakeLists.txt @@ -112,7 +112,7 @@ endif() target_include_directories(iked PRIVATE ${INC_DIRS}) target_include_directories(iked-shared PRIVATE ${INC_DIRS}) -if(CLUSTERFUZZ AND DEFINED ENV{CC} AND DEFINED ENV{CFLAGS}) +if(DEFINED ENV{CLUSTERFUZZLITE}) target_link_libraries(iked-shared "-lm -Wl,-Bstatic -lssl -lcrypto -levent -Wl,-Bdynamic" compat ) diff --git a/iked/ikev2_pld.c b/iked/ikev2_pld.c index b729d68f..05ed27a0 100644 --- a/iked/ikev2_pld.c +++ b/iked/ikev2_pld.c @@ -853,9 +853,6 @@ ikev2_pld_cert(struct iked *env, struct ikev2_payload *pld, } } - if (certid->id_buf) { - ibuf_free(certid->id_buf); - } if ((certid->id_buf = ibuf_new(buf, len)) == NULL) { log_debug("%s: failed to save cert", __func__); return (-1); diff --git a/regress/parser-libfuzzer/CMakeLists.txt b/regress/parser-libfuzzer/CMakeLists.txt index 0e267952..a964d83f 100644 --- a/regress/parser-libfuzzer/CMakeLists.txt +++ b/regress/parser-libfuzzer/CMakeLists.txt @@ -28,7 +28,7 @@ target_include_directories(test_libfuzzer ) # when using clusterfuzz we need static linking and clusterfuzz' compiler arguments -if (DEFINED ENV{CC} AND DEFINED ENV{CFLAGS}) +if (DEFINED ENV{CLUSTERFUZZLITE}) target_link_libraries(test_libfuzzer "-lm -Wl,-Bstatic -lssl -lcrypto -levent" compat iked-shared $ENV{LIB_FUZZING_ENGINE} )