mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
fuzz: Get rid of cpp mess in fuzzers
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
project(fuzzing CXX)
|
project(fuzzing CXX)
|
||||||
|
|
||||||
macro(fuzzer name)
|
macro(fuzzer name)
|
||||||
add_executable(${name} ${name}.cpp)
|
add_executable(${name} ${name}.c)
|
||||||
target_link_libraries(${name}
|
target_link_libraries(${name}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
ssh::static)
|
ssh::static)
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -52,5 +50,3 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
@ -14,8 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -51,5 +49,3 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
@ -18,6 +18,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define LIBSSH_STATIC 1
|
#define LIBSSH_STATIC 1
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
@ -83,7 +84,7 @@ static void select_loop(ssh_session session, ssh_channel channel)
|
|||||||
ssh_event_free(event);
|
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_session session = NULL;
|
||||||
ssh_channel channel = NULL;
|
ssh_channel channel = NULL;
|
@ -24,6 +24,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define LIBSSH_STATIC 1
|
#define LIBSSH_STATIC 1
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
@ -117,7 +118,7 @@ static int write_rsa_hostkey(const char *rsakey_path)
|
|||||||
return 0;
|
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};
|
int socket_fds[2] = {-1, -1};
|
||||||
ssize_t nwritten;
|
ssize_t nwritten;
|
Reference in New Issue
Block a user