Fix map bug: 'foo' and 'foobar' --> key collision
This commit is contained in:
@@ -90,10 +90,7 @@ bool obj_insert(obj_t m, char* const key, struct json_value* value)
|
|||||||
|
|
||||||
/* traverse linked list to end or until key is found */
|
/* traverse linked list to end or until key is found */
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
if (cur->key == NULL)
|
if (strcmp(cur->key, key) == 0)
|
||||||
err(EXIT_FAILURE, "entry without key");
|
|
||||||
|
|
||||||
if (strncmp(cur->key, key, strlen(key)) == 0)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
|
|||||||
Reference in New Issue
Block a user