libart icon indicating copy to clipboard operation
libart copied to clipboard

[BUG] key_len not work with longer key

Open pengtianabc opened this issue 5 years ago • 0 comments

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... }

pengtianabc avatar Jan 04 '20 11:01 pengtianabc