fuzz: Add fuzzer for identification_t
This commit is contained in:
parent
936d101d99
commit
d3bd576c46
|
@ -1,4 +1,5 @@
|
|||
fuzz_certs
|
||||
fuzz_crls
|
||||
fuzz_ids
|
||||
fuzz_pa_tnc
|
||||
fuzz_pb_tnc
|
||||
|
|
|
@ -25,7 +25,7 @@ pb_tnc_ldflags = \
|
|||
$(top_builddir)/src/libtncif/.libs/libtncif.a \
|
||||
$(fuzz_ldflags)
|
||||
|
||||
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_pa_tnc fuzz_pb_tnc
|
||||
FUZZ_TARGETS=fuzz_certs fuzz_crls fuzz_ids fuzz_pa_tnc fuzz_pb_tnc
|
||||
|
||||
all-local: $(FUZZ_TARGETS)
|
||||
|
||||
|
@ -37,6 +37,9 @@ fuzz_certs: fuzz_certs.c ${libfuzzer}
|
|||
fuzz_crls: fuzz_crls.c ${libfuzzer}
|
||||
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
|
||||
|
||||
fuzz_ids: fuzz_ids.c ${libfuzzer}
|
||||
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(fuzz_ldflags)
|
||||
|
||||
fuzz_pa_tnc: fuzz_pa_tnc.c ${libfuzzer}
|
||||
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -o $@ $< $(pa_tnc_ldflags)
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tobias Brunner
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <library.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
|
||||
{
|
||||
identification_t *id;
|
||||
chunk_t chunk;
|
||||
|
||||
dbg_default_set_level(-1);
|
||||
library_init(NULL, "fuzz_ids");
|
||||
|
||||
chunk = chunk_create((u_char*)buf, len);
|
||||
id = identification_create_from_data(chunk);
|
||||
DESTROY_IF(id);
|
||||
|
||||
library_deinit();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue