]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
Fix searching with an empty string
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 May 2020 16:37:15 +0000 (16:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 May 2020 16:37:15 +0000 (16:37 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/as.c

index 947bfd2872b662aa7fce571328e689fe72f1f8c3..f5e7dd4f3842707bc5d99991a6311e4a115e5fea 100644 (file)
--- a/src/as.c
+++ b/src/as.c
@@ -135,6 +135,10 @@ int loc_as_to_database_v0(struct loc_as* as, struct loc_stringpool* pool,
 }
 
 int loc_as_match_string(struct loc_as* as, const char* string) {
+       // Match all AS when no search string is set
+       if (!string)
+               return 1;
+
        // Search if string is in name
        if (strcasestr(as->name, string) != NULL)
                return 1;