Skip to content

[BUG] key_len not work with longer key #42

Description

@pengtianabc

BUG:

art_insert(&tree, "example", strlen("example"));
/* follow will success */
art_search(&tree, "example", strlen("example"));
/* follow will fail */
art_search(&tree, "example.com", strlen("example"));

FIX:

void* art_search(const art_tree *t, const unsigned char *key, int key_len) {
...skip...
// Recursively search
child = find_child(n,depth < key_len ? key[depth]: 0);
n = (child) ? *child : NULL;
...skip...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions