1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

fuzzing: check for NULL on ldb_init()

We simply return 0 because failure here is not a problem with the code we
are actually trying to fuzz. Without this asan is unhappy.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Douglas Bagnall 2020-01-17 09:59:26 +13:00 committed by Andreas Schneider
parent 75367e4b06
commit 6786ec2c96
3 changed files with 11 additions and 2 deletions

View File

@ -27,6 +27,9 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len)
{
struct ldb_dn *dn = NULL;
struct ldb_context *ldb = ldb_init(NULL, NULL);
if (ldb == NULL) {
return 0;
}
/*
* We copy the buffer in order to NUL-terminate, because running off
* the end of the string would be an uninteresting crash.

View File

@ -26,8 +26,11 @@ char buf[MAX_LENGTH + 1] = {0};
int LLVMFuzzerTestOneInput(uint8_t *input, size_t len)
{
struct ldb_ldif *ldif = NULL;
struct ldb_context *ldb = ldb_init(NULL, NULL);
const char *s = NULL;
struct ldb_context *ldb = ldb_init(NULL, NULL);
if (ldb == NULL) {
return 0;
}
if (len > MAX_LENGTH) {
len = MAX_LENGTH;

View File

@ -27,8 +27,11 @@ int LLVMFuzzerTestOneInput(uint8_t *input, size_t len)
{
struct ldb_control *control = NULL;
struct ldb_context *ldb = ldb_init(NULL, NULL);
if (ldb == NULL) {
return 0;
}
/*
* We copy the buffer in order to NUL-teminate, because running off
* We copy the buffer in order to NUL-terminate, because running off
* the end of the string would be an uninteresting crash.
*/
if (len > MAX_LENGTH) {