From edfea67b652f803861eace9c2c829e709d1fc9e2 Mon Sep 17 00:00:00 2001 From: olemorud Date: Tue, 25 Apr 2023 05:01:28 +0200 Subject: [PATCH] Fix map bug: 'foo' and 'foobar' --> key collision --- src/json_value.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/json_value.c b/src/json_value.c index abff305..ae7af3c 100644 --- a/src/json_value.c +++ b/src/json_value.c @@ -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 */ while (cur != NULL) { - if (cur->key == NULL) - err(EXIT_FAILURE, "entry without key"); - - if (strncmp(cur->key, key, strlen(key)) == 0) + if (strcmp(cur->key, key) == 0) break; cur = cur->next;