From 314c57d414bb5d6946bad6d6ce6ae5fa249ab4d6 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 8 Feb 2022 19:12:05 +0100 Subject: [PATCH] fuzz: Get rid of cpp mess in fuzzers Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- tests/fuzz/CMakeLists.txt | 2 +- .../{ssh_bind_config_fuzzer.cpp => ssh_bind_config_fuzzer.c} | 4 ---- ...sh_client_config_fuzzer.cpp => ssh_client_config_fuzzer.c} | 4 ---- tests/fuzz/{ssh_client_fuzzer.cpp => ssh_client_fuzzer.c} | 3 ++- tests/fuzz/{ssh_server_fuzzer.cpp => ssh_server_fuzzer.c} | 3 ++- 5 files changed, 5 insertions(+), 11 deletions(-) rename tests/fuzz/{ssh_bind_config_fuzzer.cpp => ssh_bind_config_fuzzer.c} (98%) rename tests/fuzz/{ssh_client_config_fuzzer.cpp => ssh_client_config_fuzzer.c} (98%) rename tests/fuzz/{ssh_client_fuzzer.cpp => ssh_client_fuzzer.c} (98%) rename tests/fuzz/{ssh_server_fuzzer.cpp => ssh_server_fuzzer.c} (98%) diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index 2d0e8fa0..9cc88616 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -1,7 +1,7 @@ project(fuzzing CXX) macro(fuzzer name) - add_executable(${name} ${name}.cpp) + add_executable(${name} ${name}.c) target_link_libraries(${name} PRIVATE ssh::static) diff --git a/tests/fuzz/ssh_bind_config_fuzzer.cpp b/tests/fuzz/ssh_bind_config_fuzzer.c similarity index 98% rename from tests/fuzz/ssh_bind_config_fuzzer.cpp rename to tests/fuzz/ssh_bind_config_fuzzer.c index 3fbecbd0..3d0d8be8 100644 --- a/tests/fuzz/ssh_bind_config_fuzzer.cpp +++ b/tests/fuzz/ssh_bind_config_fuzzer.c @@ -14,8 +14,6 @@ * limitations under the License. */ -extern "C" { - #include #include #include @@ -52,5 +50,3 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) return 0; } - -} diff --git a/tests/fuzz/ssh_client_config_fuzzer.cpp b/tests/fuzz/ssh_client_config_fuzzer.c similarity index 98% rename from tests/fuzz/ssh_client_config_fuzzer.cpp rename to tests/fuzz/ssh_client_config_fuzzer.c index 47fd4222..7c98e385 100644 --- a/tests/fuzz/ssh_client_config_fuzzer.cpp +++ b/tests/fuzz/ssh_client_config_fuzzer.c @@ -14,8 +14,6 @@ * limitations under the License. */ -extern "C" { - #include #include #include @@ -51,5 +49,3 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) return 0; } - -} diff --git a/tests/fuzz/ssh_client_fuzzer.cpp b/tests/fuzz/ssh_client_fuzzer.c similarity index 98% rename from tests/fuzz/ssh_client_fuzzer.cpp rename to tests/fuzz/ssh_client_fuzzer.c index 8480223c..2e3a0da6 100644 --- a/tests/fuzz/ssh_client_fuzzer.cpp +++ b/tests/fuzz/ssh_client_fuzzer.c @@ -18,6 +18,7 @@ #include #include #include +#include #define LIBSSH_STATIC 1 #include @@ -83,7 +84,7 @@ static void select_loop(ssh_session session, ssh_channel channel) ssh_event_free(event); } -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ssh_session session = NULL; ssh_channel channel = NULL; diff --git a/tests/fuzz/ssh_server_fuzzer.cpp b/tests/fuzz/ssh_server_fuzzer.c similarity index 98% rename from tests/fuzz/ssh_server_fuzzer.cpp rename to tests/fuzz/ssh_server_fuzzer.c index 26498df6..8c7913a3 100644 --- a/tests/fuzz/ssh_server_fuzzer.cpp +++ b/tests/fuzz/ssh_server_fuzzer.c @@ -24,6 +24,7 @@ #include #include #include +#include #define LIBSSH_STATIC 1 #include @@ -117,7 +118,7 @@ static int write_rsa_hostkey(const char *rsakey_path) return 0; } -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int socket_fds[2] = {-1, -1}; ssize_t nwritten;