From efc9236fbc869777aad4d308b05b73e90ea18e5f Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 24 Jan 2021 08:26:03 +0100 Subject: [PATCH] Fix the return value for a NULL key An example where the filter functions can be called with a NULL key is when a bluetooth discovery fails to retrieve the name of the remote device. In such case, we have no information to detect whether the bluetooth device matches a known dive computer or not, and thus it shouldn't be filtered out. --- src/descriptor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/descriptor.c b/src/descriptor.c index 60a8fbd..64715e2 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -495,7 +495,7 @@ static int dc_filter_internal (const void *key, const void *values, size_t count, size_t size, dc_match_t match, void *params_dst, const void *params_src, size_t params_size) { if (key == NULL) - return 0; + return 1; for (size_t i = 0; i < count; ++i) { if (match (key, (const unsigned char *) values + i * size)) {