The function '_vconf_keylist_lookup' coulded return a node
that was not matching the requested 'keyname'. For example,
searching the key "acl" in a list containing "aclxxxx", "acl"
would return the node "aclxxx" instead of "acl".
Also compute the length to be compared only one time, not
at each turn of the loop.
Change-Id: Id26e9d0eace311e5537fbce075f912d0a263f31d
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
keynode_t **before_keynode)
{
keynode_t *found_node, *temp_node = NULL;
+ size_t length = 1 + strlen(keyname);
found_node = _vconf_keylist_headnode(keylist);
return NULL;
}
- if (!strncmp(keyname, found_node->keyname, strlen(keyname))) {
+ if (!memcmp(keyname, found_node->keyname, length)) {
if (before_keynode) {
*before_keynode = temp_node;
}